[PATCH] virtio_scsi: check on resp-sense_len instead of 'sense_buffer'

2014-07-18 Thread Ming Lei
The 'sense_buffer' of 'struct scsi_cmnd' is always true, but resp-sense_len is only set if there is sense available. Signed-off-by: Ming Lei ming@canonical.com --- drivers/scsi/virtio_scsi.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git

Re: [PATCH] virtio_scsi: check on resp-sense_len instead of 'sense_buffer'

2014-07-18 Thread Paolo Bonzini
Il 18/07/2014 16:57, Ming Lei ha scritto: - if (sc-sense_buffer) { + if (resp-sense_len) { In the (unlikely) case that sc-sense_buffer == NULL, you'd pass a NULL to memcpy. If you want, you can change this if to if (sc-sense_buffer resp-sense_len) but frankly it seems like

Re: [PATCH] virtio_scsi: check on resp-sense_len instead of 'sense_buffer'

2014-07-18 Thread Ming Lei
On Fri, Jul 18, 2014 at 11:00 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 18/07/2014 16:57, Ming Lei ha scritto: - if (sc-sense_buffer) { + if (resp-sense_len) { In the (unlikely) case that sc-sense_buffer == NULL, you'd pass a NULL to memcpy. Every valid scsi_cmnd should have