diff options
author | KONRAD Frederic <fred.konrad@greensocs.com> | 2013-03-21 15:15:12 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-03-26 09:26:34 -0500 |
commit | 22219527f4272f5199a581bbd3950e9ba96bbc75 (patch) | |
tree | c2cfe83ff4d04744e3fc7b8c7818b868ce4ec4f5 /hw/virtio-scsi.c | |
parent | 394e2e4c59294f2c5da58d2970693667218c7cf3 (diff) |
virtio-scsi: allocate cmd_vqs array separately.
Allocate/Free the cmd_vqs array separately to have a fixed size device.
Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-id: 1363875320-7985-3-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/virtio-scsi.c')
-rw-r--r-- | hw/virtio-scsi.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/hw/virtio-scsi.c b/hw/virtio-scsi.c index 55191c566c..08fcb80b1b 100644 --- a/hw/virtio-scsi.c +++ b/hw/virtio-scsi.c @@ -690,12 +690,12 @@ VirtIODevice *virtio_scsi_init(DeviceState *dev, VirtIOSCSIConf *proxyconf) { VirtIOSCSI *s; static int virtio_scsi_id; - size_t sz; int i; - sz = sizeof(VirtIOSCSI) + proxyconf->num_queues * sizeof(VirtQueue *); s = (VirtIOSCSI *)virtio_common_init("virtio-scsi", VIRTIO_ID_SCSI, - sizeof(VirtIOSCSIConfig), sz); + sizeof(VirtIOSCSIConfig), + sizeof(VirtIOSCSI)); + s->cmd_vqs = g_malloc0(proxyconf->num_queues * sizeof(VirtQueue *)); s->qdev = dev; s->conf = *proxyconf; @@ -730,5 +730,6 @@ void virtio_scsi_exit(VirtIODevice *vdev) { VirtIOSCSI *s = (VirtIOSCSI *)vdev; unregister_savevm(s->qdev, "virtio-scsi", s); + g_free(s->cmd_vqs); virtio_cleanup(vdev); } |