All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bart.vanassche@sandisk.com>
To: Hannes Reinecke <hare@suse.de>,
	James Bottomley <james.bottomley@hansenpartnership.com>
Cc: Christoph Hellwig <hch@lst.de>,
	linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.com>
Subject: Re: [PATCH] scsi: Fixup fixed sense generation
Date: Fri, 31 Jul 2015 07:05:48 -0700	[thread overview]
Message-ID: <55BB80BC.5080109@sandisk.com> (raw)
In-Reply-To: <1438347903-106697-1-git-send-email-hare@suse.de>

On 07/31/15 06:05, Hannes Reinecke wrote:
> Fixed sense reserves only 32 bits for the 'information' field,
> so we need to restrict the 'information' value to avoid sense
> data corruption.
> Also the sense key is only 4 bits.
>
> Signed-off-by: Hannes Reinecke <hare@suse.com>
> ---
>   drivers/scsi/scsi_error.c | 10 +++++++---
>   1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
> index 106884a..ba7ffc4 100644
> --- a/drivers/scsi/scsi_error.c
> +++ b/drivers/scsi/scsi_error.c
> @@ -2510,13 +2510,13 @@ void scsi_build_sense_buffer(int desc, u8 *buf, u8 key, u8 asc, u8 ascq)
>   {
>   	if (desc) {
>   		buf[0] = 0x72;	/* descriptor, current */
> -		buf[1] = key;
> +		buf[1] = key & 0x0f;
>   		buf[2] = asc;
>   		buf[3] = ascq;
>   		buf[7] = 0;
>   	} else {
>   		buf[0] = 0x70;	/* fixed, current */
> -		buf[2] = key;
> +		buf[2] = key & 0x0f;
>   		buf[7] = 0xa;
>   		buf[12] = asc;
>   		buf[13] = ascq;

Please split these changes into two separate patches - one patch for the 
scsi_build_sense_buffer() changes and another patch for the 
scsi_set_sense_information() changes. Please also add a statement that 
triggers a kernel warning if an out-of-range key value is passed to 
scsi_build_sense_buffer() instead of ignoring out-of-range sense key 
values silently.

Thanks,

Bart.



  reply	other threads:[~2015-07-31 14:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-31 13:05 [PATCH] scsi: Fixup fixed sense generation Hannes Reinecke
2015-07-31 14:05 ` Bart Van Assche [this message]
2015-08-11  6:49 ` Sagi Grimberg
2015-08-13  7:31   ` Hannes Reinecke

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=55BB80BC.5080109@sandisk.com \
    --to=bart.vanassche@sandisk.com \
    --cc=hare@suse.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=james.bottomley@hansenpartnership.com \
    --cc=linux-scsi@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.