Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M5jQT-0007Tt-5l for qemu-devel@nongnu.org; Sun, 17 May 2009 12:41:25 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M5jQO-0007T1-Mx for qemu-devel@nongnu.org; Sun, 17 May 2009 12:41:24 -0400 Received: from [199.232.76.173] (port=34748 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M5jQO-0007Sw-Ki for qemu-devel@nongnu.org; Sun, 17 May 2009 12:41:20 -0400 Received: from smtp1-g21.free.fr ([212.27.42.1]:36494) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M5jQN-00024n-LB for qemu-devel@nongnu.org; Sun, 17 May 2009 12:41:20 -0400 Received: from smtp1-g21.free.fr (localhost [127.0.0.1]) by smtp1-g21.free.fr (Postfix) with ESMTP id 9C66F9401AB for ; Sun, 17 May 2009 18:41:16 +0200 (CEST) Received: from jcd-laptop.localnet (lns-bzn-31-82-252-199-121.adsl.proxad.net [82.252.199.121]) by smtp1-g21.free.fr (Postfix) with ESMTP id AFEFB9401E6 for ; Sun, 17 May 2009 18:41:13 +0200 (CEST) From: "Jean-Christophe Dubois" Date: Sun, 17 May 2009 18:41:16 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200905171841.16655.jcd@tribudubois.net> Subject: [Qemu-devel] [PATCH] initialize struct sigevent before timer_create List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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;