From: Alon Levy Date: Wed, 19 May 2010 09:31:38 +0000 (+0530) Subject: virtio-serial-bus: fix ports_map allocation on init X-Git-Tag: TizenStudio_2.0_p2.3.2~208^2~7742 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a132a679c33ae2f8f6935f92c2a8043015cd917c;p=sdk%2Femulator%2Fqemu.git virtio-serial-bus: fix ports_map allocation on init Fix for too small allocation to ports_map Signed-off-by: Alon Levy Signed-off-by: Amit Shah Signed-off-by: Anthony Liguori --- 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)