From patchwork Wed May 19 09:31:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: virtio-serial-bus: fix ports_map allocation on init Date: Tue, 18 May 2010 23:31:38 -0000 From: Amit Shah X-Patchwork-Id: 52967 Message-Id: To: Anthony Liguori Cc: Amit Shah , Alon Levy , qemu list From: Alon Levy Fix for too small allocation to ports_map Signed-off-by: Alon Levy Signed-off-by: Amit Shah --- hw/virtio-serial-bus.c | 3 ++- 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)