From: Ingo Molnar Subject: Re: [PATCH 1/2] kvm tools: Zero out event before calling epoll_ctl() Date: Tue, 6 Dec 2011 13:38:06 +0100 Message-ID: <20111206123806.GA3796@elte.hu> References: <1323173731-7651-1-git-send-email-levinsasha928@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: penberg@kernel.org, gorcunov@gmail.com, asias.hejun@gmail.com, kvm@vger.kernel.org To: Sasha Levin Return-path: Received: from mx2.mail.elte.hu ([157.181.151.9]:55064 "EHLO mx2.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933093Ab1LFMjo (ORCPT ); Tue, 6 Dec 2011 07:39:44 -0500 Content-Disposition: inline In-Reply-To: <1323173731-7651-1-git-send-email-levinsasha928@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: * Sasha Levin 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 > --- > 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