Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M6rBv-0005cv-QP for qemu-devel@nongnu.org; Wed, 20 May 2009 15:11:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M6rBr-0005ZG-BG for qemu-devel@nongnu.org; Wed, 20 May 2009 15:11:03 -0400 Received: from [199.232.76.173] (port=52192 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M6rBq-0005Z4-UU for qemu-devel@nongnu.org; Wed, 20 May 2009 15:10:59 -0400 Received: from mx2.redhat.com ([66.187.237.31]:32895) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M6rBq-0003p9-BJ for qemu-devel@nongnu.org; Wed, 20 May 2009 15:10:58 -0400 Date: Wed, 20 May 2009 16:10:05 -0300 From: Marcelo Tosatti Subject: Re: [Qemu-devel] [PATCH] initialize struct sigevent before timer_create Message-ID: <20090520191005.GB28898@amt.cnet> References: <200905171841.16655.jcd@tribudubois.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200905171841.16655.jcd@tribudubois.net> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jean-Christophe Dubois Cc: qemu-devel@nongnu.org Looks good. On Sun, May 17, 2009 at 06:41:16PM +0200, Jean-Christophe Dubois wrote: > When qemu is run under valgrind, valgrind shows the following output > on exit: > > ==3648== 1 errors in context 2 of 2: > ==3648== Syscall param timer_create(evp) points to uninitialised byte(s) > ==3648== at 0x54E936A: timer_create (in /lib/librt-2.9.so) > ==3648== by 0x405DCF: dynticks_start_timer (vl.c:1549) > ==3648== by 0x40A966: main (vl.c:1726) > ==3648== Address 0x7fefffb34 is on thread 1's stack > ==3648== Uninitialised value was created by a stack allocation > ==3648== at 0x405D60: dynticks_start_timer (vl.c:1534) > > This patch is a simple fix to remove this potential problem. > > Signed-off-by: Jean-Christophe DUBOIS > > --- qemu.org/vl.c 2009-05-16 17:57:27.000000000 +0200 > +++ qemu/vl.c 2009-05-16 23:06:52.000000000 +0200 > @@ -1542,6 +1542,11 @@ > > sigaction(SIGALRM, &act, NULL); > > + /* > + * Initialize ev struct to 0 to avoid valgrind complaining > + * about uninitialized data in timer_create call > + */ > + memset(&ev, 0, sizeof(ev)); > ev.sigev_value.sival_int = 0; > ev.sigev_notify = SIGEV_SIGNAL; > ev.sigev_signo = SIGALRM; >