Skip to contentSkip to conversation

virtio-scsi: sense in virtio_scsi_command_complete

PATCH In review Ting Wang 2 participants 2 messages Oct 27, 2014

lore
Share & tools
lore

Ting Wang

author
#0 lore raw

PATCH 1/1 virtio-scsi: sense in virtio_scsi_command_complete

If req->resp.cmd.status is not GOOD, the address of sense for qemu_iovec_from_buf should be modified from &req->resp to sense.

---
 hw/scsi/virtio-scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/scsi/virtio-scsi.c +1 -1
index a1725b8..fe094a5 100644
@@ -448,7 +448,7 @@ static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status,
         sense_len = scsi_req_get_sense(r, sense, sizeof(sense));
         sense_len = MIN(sense_len, req->resp_iov.size - sizeof(req->resp.cmd));
         qemu_iovec_from_buf(&req->resp_iov, sizeof(req->resp.cmd),
-                            &req->resp, sense_len);
+                            sense, sense_len);
         req->resp.cmd.sense_len = virtio_tswap32(vdev, sense_len);
     }
     virtio_scsi_complete_cmd_req(req);
Signature · 1 line
1.8.5
#1 lore raw
Quoted 14 lines · Ting Wang

If req->resp.cmd.status is not GOOD, the address of sense for qemu_iovec_from_buf should be modified from &req->resp to sense.

---
 hw/scsi/virtio-scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/scsi/virtio-scsi.c +0 -0
index a1725b8..fe094a5 100644

hw/scsi/virtio-scsi.c static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status, · line 454

Quoted 8 lines
hw/scsi/virtio-scsi.c +1 -1
@@ -448,7 +448,7 @@ static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status,
         sense_len = scsi_req_get_sense(r, sense, sizeof(sense));
         sense_len = MIN(sense_len, req->resp_iov.size - sizeof(req->resp.cmd));
         qemu_iovec_from_buf(&req->resp_iov, sizeof(req->resp.cmd),
-                            &req->resp, sense_len);
+                            sense, sense_len);
         req->resp.cmd.sense_len = virtio_tswap32(vdev, sense_len);
     }
     virtio_scsi_complete_cmd_req(req);

Embarrassing. Thanks, applied.

Paolo