mirror of https://github.com/proxmox/mirror_qemu
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>master
parent
394e2e4c59
commit
22219527f4
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ typedef struct VirtIOSCSI {
|
|||
bool events_dropped;
|
||||
VirtQueue *ctrl_vq;
|
||||
VirtQueue *event_vq;
|
||||
VirtQueue *cmd_vqs[0];
|
||||
VirtQueue **cmd_vqs;
|
||||
} VirtIOSCSI;
|
||||
|
||||
#define DEFINE_VIRTIO_SCSI_PROPERTIES(_state, _features_field, _conf_field) \
|
||||
|
|
Loading…
Reference in New Issue