Re: [PATCH v7 42/46] virtio_scsi: v1.0 support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 30 Nov 2014 17:12:47 +0200
"Michael S. Tsirkin" <mst@xxxxxxxxxx> wrote:

> Note: for consistency, and to avoid sparse errors,
>   convert all fields, even those no longer in use
>   for virtio v1.0.
> 
> Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
> Acked-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> ---
>  include/linux/virtio_scsi.h | 32 +++++++++++++++-------------
>  drivers/scsi/virtio_scsi.c  | 51 ++++++++++++++++++++++++++++-----------------
>  2 files changed, 49 insertions(+), 34 deletions(-)
> 

> @@ -196,10 +196,13 @@ static void virtscsi_complete_cmd(struct virtio_scsi *vscsi, void *buf)
>  		break;
>  	}
> 
> -	WARN_ON(resp->sense_len > VIRTIO_SCSI_SENSE_SIZE);
> +	WARN_ON(virtio32_to_cpu(vscsi->vdev, resp->sense_len) >
> +		VIRTIO_SCSI_SENSE_SIZE);

Introduce a local variable for this? Might make this statement and the
min_t statement below easier to read.

>  	if (sc->sense_buffer) {
>  		memcpy(sc->sense_buffer, resp->sense,
> -		       min_t(u32, resp->sense_len, VIRTIO_SCSI_SENSE_SIZE));
> +		       min_t(u32,
> +			     virtio32_to_cpu(vscsi->vdev, resp->sense_len),
> +			     VIRTIO_SCSI_SENSE_SIZE));
>  		if (resp->sense_len)
>  			set_driver_byte(sc, DRIVER_SENSE);
>  	}

Otherwise looks good to me.

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux