qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH] initialize struct sigevent before timer_create


From: Jean-Christophe Dubois
Subject: [Qemu-devel] [PATCH] initialize struct sigevent before timer_create
Date: Sun, 17 May 2009 18:41:16 +0200
User-agent: KMail/1.11.2 (Linux/2.6.28-11-generic; KDE/4.2.2; x86_64; ; )

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 <address@hidden>

--- 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;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]