Commit 9ed415b28b0c808e8b0fc631902cb9ce277f0245
Committed by
Anthony Liguori
1 parent
e332340a
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>
Showing
1 changed file
with
5 additions
and
0 deletions
vl.c
... | ... | @@ -1542,6 +1542,11 @@ static int dynticks_start_timer(struct qemu_alarm_timer *t) |
1542 | 1542 | |
1543 | 1543 | sigaction(SIGALRM, &act, NULL); |
1544 | 1544 | |
1545 | + /* | |
1546 | + * Initialize ev struct to 0 to avoid valgrind complaining | |
1547 | + * about uninitialized data in timer_create call | |
1548 | + */ | |
1549 | + memset(&ev, 0, sizeof(ev)); | |
1545 | 1550 | ev.sigev_value.sival_int = 0; |
1546 | 1551 | ev.sigev_notify = SIGEV_SIGNAL; |
1547 | 1552 | ev.sigev_signo = SIGALRM; | ... | ... |