public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: thuth@linux.vnet.ibm.com, linux-scsi@vger.kernel.org,
	rusty@au1.ibm.com, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	dahi@linux.vnet.ibm.com,
	"James E.J. Bottomley" <JBottomley@parallels.com>,
	pbonzini@redhat.com, David Miller <davem@davemloft.net>
Subject: Re: [PATCH v7 42/46] virtio_scsi: v1.0 support
Date: Mon, 1 Dec 2014 13:50:01 +0100	[thread overview]
Message-ID: <20141201135001.142bd29a.cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <1417359787-10138-43-git-send-email-mst@redhat.com>

On Sun, 30 Nov 2014 17:12:47 +0200
"Michael S. Tsirkin" <mst@redhat.com> 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@redhat.com>
> Acked-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  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.

  reply	other threads:[~2014-12-01 12:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1417359787-10138-1-git-send-email-mst@redhat.com>
2014-11-30 15:12 ` [PATCH v7 42/46] virtio_scsi: v1.0 support Michael S. Tsirkin
2014-12-01 12:50   ` Cornelia Huck [this message]
2014-12-01 12:53     ` Michael S. Tsirkin
2014-12-01 12:54       ` Michael S. Tsirkin
2014-12-01 12:55       ` Cornelia Huck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141201135001.142bd29a.cornelia.huck@de.ibm.com \
    --to=cornelia.huck@de.ibm.com \
    --cc=JBottomley@parallels.com \
    --cc=dahi@linux.vnet.ibm.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rusty@au1.ibm.com \
    --cc=thuth@linux.vnet.ibm.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox