From: Li Qiang Date: Sat, 15 Dec 2018 12:03:51 +0000 (-0800) Subject: tests: vhost-user-test: initialize 'fd' in chr_read X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=82248cd45e6f82da892127c4749ae89335217e31;p=qemu.git tests: vhost-user-test: initialize 'fd' in chr_read Currently when processing VHOST_USER_SET_VRING_CALL if 'qemu_chr_fe_get_msgfds' get no fd, the 'fd' will be a stack uninitialized value. Signed-off-by: Li Qiang Reviewed-by: Thomas Huth Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 54982f68e7..84e50d84e7 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -309,7 +309,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size) CharBackend *chr = &s->chr; VhostUserMsg msg; uint8_t *p = (uint8_t *) &msg; - int fd; + int fd = -1; if (s->test_fail) { qemu_chr_fe_disconnect(chr);