summaryrefslogtreecommitdiff
path: root/hw
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
commit161c90057562b8842093046317b155f96e4b98b0 (patch)
treebf7e691414fcd5f2bf044262c4fc7ee954ef8d4e /hw
parent9179e5e0ec6f8705fc9a17b049dedcd787189a0d (diff)
downloadqemu-161c90057562b8842093046317b155f96e4b98b0.tar.gz
qemu-161c90057562b8842093046317b155f96e4b98b0.tar.bz2
qemu-161c90057562b8842093046317b155f96e4b98b0.zip
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')
-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 3ce95e8f1e..7f9d28f896 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)