mirror of https://gitlab.com/qemu-project/qemu
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 <liq3ea@163.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
a5390d9367
commit
82248cd45e
|
@ -309,7 +309,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
|
||||||
CharBackend *chr = &s->chr;
|
CharBackend *chr = &s->chr;
|
||||||
VhostUserMsg msg;
|
VhostUserMsg msg;
|
||||||
uint8_t *p = (uint8_t *) &msg;
|
uint8_t *p = (uint8_t *) &msg;
|
||||||
int fd;
|
int fd = -1;
|
||||||
|
|
||||||
if (s->test_fail) {
|
if (s->test_fail) {
|
||||||
qemu_chr_fe_disconnect(chr);
|
qemu_chr_fe_disconnect(chr);
|
||||||
|
|
Loading…
Reference in New Issue