aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio-serial-bus.c
diff options
context:
space:
mode:
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 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)