linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tyrel Datwyler <turtle.in.the.kernel@gmail.com>
To: Bart Van Assche <bart.vanassche@sandisk.com>,
	Tyrel Datwyler <tyreld@linux.vnet.ibm.com>,
	james.bottomley@hansenpartnership.com
Cc: martin.petersen@oracle.com, linux-scsi@vger.kernel.org
Subject: Re: [PATCH] scsi: fix upper bounds check of sense key in scsi_sense_key_string()
Date: Thu, 11 Aug 2016 14:21:47 -0700	[thread overview]
Message-ID: <57ACEC6B.7090301@gmail.com> (raw)
In-Reply-To: <998bca14-1871-0b9e-a748-68dd39a0b634@sandisk.com>

On 08/09/2016 01:08 PM, Bart Van Assche wrote:
> On 08/04/2016 02:32 PM, Tyrel Datwyler wrote:
>> Commit 655ee63cf371 added a "Completed" sense string with key 0xF to
>> snstext[], but failed to updated the upper bounds check of the sense key in
>> scsi_sense_key_string().
>>
>> Fixes: 655ee63cf371 ("[SCSI] scsi constants: command, sense key + additional sense strings")
>> Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
>> ---
>>  drivers/scsi/constants.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
>> index 83458f7..70d8dc4 100644
>> --- a/drivers/scsi/constants.c
>> +++ b/drivers/scsi/constants.c
>> @@ -362,7 +362,7 @@ static const char * const snstext[] = {
>>  /* Get sense key string or NULL if not available */
>>  const char *
>>  scsi_sense_key_string(unsigned char key) {
>> -	if (key <= 0xE)
>> +	if (key <= 0xF)
>>  		return snstext[key];
>>  	return NULL;
>>  }
> 
> Hello Tyrel,
> 
> Please move the opening brace ("{") to a line of its own.
> 
> If you change "<= 0xF" into "< ARRAY_SIZE(snstext)" then you are welcome

This actually occurred to me as a better long term solution after I had
already posted the patch.

> to add:
> 
> Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>

Thanks for your comments. I'll address and spin a version 2.

-Tyrel

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


      reply	other threads:[~2016-08-11 21:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-04 21:32 [PATCH] scsi: fix upper bounds check of sense key in scsi_sense_key_string() Tyrel Datwyler
2016-08-09 20:08 ` Bart Van Assche
2016-08-11 21:21   ` Tyrel Datwyler [this message]

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=57ACEC6B.7090301@gmail.com \
    --to=turtle.in.the.kernel@gmail.com \
    --cc=bart.vanassche@sandisk.com \
    --cc=james.bottomley@hansenpartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=tyreld@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).