Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Ming Lei <ming.lei@canonical.com>,
	"James E.J. Bottomley" <JBottomley@parallels.com>
Cc: linux-scsi@vger.kernel.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH] virtio_scsi: check on resp->sense_len instead of 'sense_buffer'
Date: Fri, 18 Jul 2014 17:00:02 +0200	[thread overview]
Message-ID: <53C93672.8030805@redhat.com> (raw)
In-Reply-To: <1405695438-18485-1-git-send-email-ming.lei@canonical.com>

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 slightly pointless churn to me.

Paolo

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



  reply	other threads:[~2014-07-18 15:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-18 14:57 [PATCH] virtio_scsi: check on resp->sense_len instead of 'sense_buffer' Ming Lei
2014-07-18 15:00 ` Paolo Bonzini [this message]
2014-07-18 15:09   ` Ming Lei

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=53C93672.8030805@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=JBottomley@parallels.com \
    --cc=hch@lst.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=ming.lei@canonical.com \
    /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