提交 a132a679 编写于 作者: A Alon Levy 提交者: Anthony Liguori

virtio-serial-bus: fix ports_map allocation on init

Fix for too small allocation to ports_map
Signed-off-by: NAlon Levy <alevy@redhat.com>
Signed-off-by: NAmit Shah <amit.shah@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 eafaf1e5
......@@ -774,7 +774,8 @@ VirtIODevice *virtio_serial_init(DeviceState *dev, uint32_t max_nr_ports)
}
vser->config.max_nr_ports = max_nr_ports;
vser->ports_map = qemu_mallocz((max_nr_ports + 31) / 32);
vser->ports_map = qemu_mallocz(((max_nr_ports + 31) / 32)
* sizeof(vser->ports_map[0]));
/*
* Reserve location 0 for a console port for backward compat
* (old kernel, new qemu)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册