scsi: virtio_scsi: fixup endian conversions for warning messages
Subsystems (3)
PATCH 1/1 scsi: virtio_scsi: fixup endian conversions for warning messages
There are several places where printing functions are being passed parameters that have not been through endian conversion functions. Use the virtio32_to_cpu to fix the warnings.
Fixes the following warnings from (prototype) sparse:drivers/scsi/virtio_scsi.c:126:9: warning: incorrect type in argument 7 (different base types)drivers/scsi/virtio_scsi.c:126:9: expected unsigned intdrivers/scsi/virtio_scsi.c:126:9: got restricted __virtio32 [usertype] sense_lendrivers/scsi/virtio_scsi.c:312:17: warning: incorrect type in argument 2 (different base types)drivers/scsi/virtio_scsi.c:312:17: expected unsigned intdrivers/scsi/virtio_scsi.c:312:17: got restricted __virtio32 [usertype] reasondrivers/scsi/virtio_scsi.c:412:17: warning: incorrect type in argument 2 (different base types)drivers/scsi/virtio_scsi.c:412:17: expected unsigned intdrivers/scsi/virtio_scsi.c:412:17: got restricted __virtio32 [usertype] event
--- drivers/scsi/virtio_scsi.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/scsi/virtio_scsi.c +9 -9
@@ -122,10 +122,11 @@ static void virtscsi_complete_cmd(struct virtio_scsi *vscsi, void *buf)struct virtio_scsi_cmd *cmd = buf;struct scsi_cmnd *sc = cmd->sc;struct virtio_scsi_cmd_resp *resp = &cmd->resp.cmd; +unsigned sense_len =virtio32_to_cpu (vscsi->vdev, resp->sense_len);dev_dbg (&sc->device->sdev_gendev,"cmd %p response %u status %#02x sense_len %u\n" , - sc, resp->response, resp->status, resp->sense_len); + sc, resp->response, resp->status, sense_len); sc->result = resp->status;virtscsi_compute_resid (sc,virtio32_to_cpu (vscsi->vdev, resp->resid));
@@ -166,13 +167,10 @@ static void virtscsi_complete_cmd(struct virtio_scsi *vscsi, void *buf)break ; } -WARN_ON (virtio32_to_cpu (vscsi->vdev, resp->sense_len) > -VIRTIO_SCSI_SENSE_SIZE ); +WARN_ON (sense_len >VIRTIO_SCSI_SENSE_SIZE );if (resp->sense_len) {memcpy (sc->sense_buffer, resp->sense, -min_t (u32, -virtio32_to_cpu (vscsi->vdev, resp->sense_len), -VIRTIO_SCSI_SENSE_SIZE )); +min_t (u32, sense_len,VIRTIO_SCSI_SENSE_SIZE )); }scsi_done (sc);
@@ -288,8 +286,9 @@ static void virtscsi_handle_transport_reset(struct virtio_scsi *vscsi,struct Scsi_Host *shost =virtio_scsi_host (vscsi->vdev);unsigned int target = event->lun[1 ];unsigned int lun = (event->lun[2 ] <<8 ) | event->lun[3 ]; +unsigned int reason =virtio32_to_cpu (vscsi->vdev, event->reason); -switch (virtio32_to_cpu (vscsi->vdev, event->reason)) { +switch (reason) {case VIRTIO_SCSI_EVT_RESET_RESCAN :if (lun ==0 ) { scsi_scan_target(&shost->shost_gendev, 0, target,
@@ -309,7 +308,7 @@ static void virtscsi_handle_transport_reset(struct virtio_scsi *vscsi, }break ;default : -pr_info ("Unsupported virtio scsi event reason %x\n" , event->reason); +pr_info ("Unsupported virtio scsi event reason %x\n" , reason); } }
@@ -409,7 +408,8 @@ static void virtscsi_handle_event(struct work_struct *work)virtscsi_handle_param_change (vscsi, event);break ;default : -pr_err ("Unsupported virtio scsi event %x\n" , event->event); +pr_err ("Unsupported virtio scsi event %x\n" , +virtio32_to_cpu (vscsi->vdev, event->event)); }virtscsi_kick_event (vscsi, event_node); }
Signature · 1 line
2.37.2.352.g3c44437643
Quoted 15 lines · Ben Dooks
There are several places where printing functions are being passed parameters that have not been through endian conversion functions. Use the
virtio32_to_cputo fix the warnings.Fixes the following warnings from (prototype) sparse:
drivers/scsi/virtio_scsi.c:126:9: warning: incorrect type in argument 7 (different base types)drivers/scsi/virtio_scsi.c:126:9: expected unsigned intdrivers/scsi/virtio_scsi.c:126:9: got restricted__virtio32[usertype]sense_lendrivers/scsi/virtio_scsi.c:312:17: warning: incorrect type in argument 2 (different base types)drivers/scsi/virtio_scsi.c:312:17: expected unsigned intdrivers/scsi/virtio_scsi.c:312:17: got restricted__virtio32[usertype] reasondrivers/scsi/virtio_scsi.c:412:17: warning: incorrect type in argument 2 (different base types)drivers/scsi/virtio_scsi.c:412:17: expected unsigned intdrivers/scsi/virtio_scsi.c:412:17: got restricted__virtio32[usertype] event
Quoted 4 lines
Signed-off-by Ben Dooks <[email protected]>--- drivers/scsi/virtio_scsi.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
Martin K. Petersen
AppliedBen,
Quoted 3 lines
There are several places where printing functions are being passed parameters that have not been through endian conversion functions. Use the
virtio32_to_cputo fix the warnings.
Applied to 7.3/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen
Martin K. Petersen
AppliedQuoted 15 lines · Ben Dooks
There are several places where printing functions are being passed parameters that have not been through endian conversion functions. Use the
virtio32_to_cputo fix the warnings.Fixes the following warnings from (prototype) sparse:
drivers/scsi/virtio_scsi.c:126:9: warning: incorrect type in argument 7 (different base types)drivers/scsi/virtio_scsi.c:126:9: expected unsigned intdrivers/scsi/virtio_scsi.c:126:9: got restricted__virtio32[usertype]sense_lendrivers/scsi/virtio_scsi.c:312:17: warning: incorrect type in argument 2 (different base types)drivers/scsi/virtio_scsi.c:312:17: expected unsigned intdrivers/scsi/virtio_scsi.c:312:17: got restricted__virtio32[usertype] reasondrivers/scsi/virtio_scsi.c:412:17: warning: incorrect type in argument 2 (different base types)drivers/scsi/virtio_scsi.c:412:17: expected unsigned intdrivers/scsi/virtio_scsi.c:412:17: got restricted__virtio32[usertype] event
Quoted 1 line
[...]
Applied to 7.3/scsi-queue, thanks!
[1/1] scsi: virtio_scsi: fixup endian conversions for warning messages
https://git.kernel.org/mkp/scsi/c/1e9036e7580b
Signature · 1 line
Martin K. Petersen