Re: [PATCH 1/2] kvm tools: Zero out event before calling epoll_ctl()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Sasha Levin <levinsasha928@xxxxxxxxx> wrote:

> Zero out struct epoll_event before calling epoll_ctl(). This isn't really
> required, but is done to avoid warnings.
> 
> Signed-off-by: Sasha Levin <levinsasha928@xxxxxxxxx>
> ---
>  tools/kvm/kvm-ipc.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/tools/kvm/kvm-ipc.c b/tools/kvm/kvm-ipc.c
> index 40ab457..68c2565 100644
> --- a/tools/kvm/kvm-ipc.c
> +++ b/tools/kvm/kvm-ipc.c
> @@ -132,7 +132,7 @@ static void *kvm_ipc__thread(void *param)
>  
>  int kvm_ipc__start(int sock)
>  {
> -	struct epoll_event ev;
> +	struct epoll_event ev = {0};
>  
>  	server_fd = sock;

While it is true that epoll_ctl() currently ignores certain 
fields so we could leave them uninitialized but generally it's 
very good practice to only pass in well-defined values to kernel 
syscalls, so the zeroing is a quality of implementation issue as 
well, not just a Valgrind warning fix.

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux