diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2015-03-11 14:31:29 +0100 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2015-03-11 18:24:29 +0100 |
commit | 03325525c3a607825ab67bf36bffaa5cf8447df2 (patch) | |
tree | 07bd152f6cadbd53aee93b3d9d5bd56231304a79 /hw/scsi | |
parent | 2106ba30105969262a7810417a57524d9a225b91 (diff) |
virtio-scsi: fix cdb/sense size
Commit "virtio-scsi: use standard-headers" added
cdb and sense into req/rep structures, which
breaks uses of sizeof for these structures,
since qemu adds its own arrays on top.
To fix, redefine CDB/sense field size to 0.
Reported-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/scsi')
-rw-r--r-- | hw/scsi/virtio-scsi.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index cfb52e8fd9..ba51e06d86 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -476,7 +476,7 @@ static int virtio_scsi_parse_cdb(SCSIDevice *dev, SCSICommand *cmd, VirtIOSCSIReq *req = hba_private; if (cmd->len == 0) { - cmd->len = MIN(VIRTIO_SCSI_CDB_SIZE, SCSI_CMD_BUF_SIZE); + cmd->len = MIN(VIRTIO_SCSI_CDB_DEFAULT_SIZE, SCSI_CMD_BUF_SIZE); memcpy(cmd->buf, buf, cmd->len); } @@ -642,8 +642,8 @@ static void virtio_scsi_reset(VirtIODevice *vdev) qbus_reset_all(&s->bus.qbus); s->resetting--; - vs->sense_size = VIRTIO_SCSI_SENSE_SIZE; - vs->cdb_size = VIRTIO_SCSI_CDB_SIZE; + vs->sense_size = VIRTIO_SCSI_SENSE_DEFAULT_SIZE; + vs->cdb_size = VIRTIO_SCSI_CDB_DEFAULT_SIZE; s->events_dropped = false; } @@ -830,8 +830,8 @@ void virtio_scsi_common_realize(DeviceState *dev, Error **errp, return; } s->cmd_vqs = g_new0(VirtQueue *, s->conf.num_queues); - s->sense_size = VIRTIO_SCSI_SENSE_SIZE; - s->cdb_size = VIRTIO_SCSI_CDB_SIZE; + s->sense_size = VIRTIO_SCSI_SENSE_DEFAULT_SIZE; + s->cdb_size = VIRTIO_SCSI_CDB_DEFAULT_SIZE; s->ctrl_vq = virtio_add_queue(vdev, VIRTIO_SCSI_VQ_SIZE, ctrl); |