aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio-serial-bus.c
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2010-05-19 15:01:38 +0530
committerAnthony Liguori <aliguori@us.ibm.com>2010-06-01 12:53:09 -0500
commita132a679c33ae2f8f6935f92c2a8043015cd917c (patch)
treebf7e691414fcd5f2bf044262c4fc7ee954ef8d4e /hw/virtio-serial-bus.c
parenteafaf1e5ab30346d6e9ac676ec6b7a3eca4ccce3 (diff)
downloadqemu-a132a679c33ae2f8f6935f92c2a8043015cd917c.zip
qemu-a132a679c33ae2f8f6935f92c2a8043015cd917c.tar.gz
qemu-a132a679c33ae2f8f6935f92c2a8043015cd917c.tar.bz2
virtio-serial-bus: fix ports_map allocation on init
Fix for too small allocation to ports_map Signed-off-by: Alon Levy <alevy@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/virtio-serial-bus.c')
-rw-r--r--hw/virtio-serial-bus.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index 3ce95e8..7f9d28f 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -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)