summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Christophe Dubois <jcd@tribudubois.net>2009-05-17 18:41:16 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-05-20 13:21:36 -0500
commit822624e5d658e7cf51f399581b8f93e61c3e2399 (patch)
treeb82deb4413e09965d8ae451059e493858a288b64
parentfe54857a130d8ce9e9f9b93b3e45e1d4c5ac9529 (diff)
downloadqemu-822624e5d658e7cf51f399581b8f93e61c3e2399.tar.gz
initialize struct sigevent before timer_create
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 <jcd@tribudubois.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--vl.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/vl.c b/vl.c
index efe29c93d2..56623fb576 100644
--- a/vl.c
+++ b/vl.c
@@ -1528,6 +1528,11 @@ static int dynticks_start_timer(struct qemu_alarm_timer *t)
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;