All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: fix upper bounds check of sense key in scsi_sense_key_string()
@ 2016-08-04 21:32 Tyrel Datwyler
  2016-08-09 20:08 ` Bart Van Assche
  0 siblings, 1 reply; 3+ messages in thread
From: Tyrel Datwyler @ 2016-08-04 21:32 UTC (permalink / raw)
  To: james.bottomley; +Cc: martin.petersen, linux-scsi, Tyrel Datwyler

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;
 }
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: fix upper bounds check of sense key in scsi_sense_key_string()
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Van Assche @ 2016-08-09 20:08 UTC (permalink / raw)
  To: Tyrel Datwyler, james.bottomley; +Cc: martin.petersen, linux-scsi

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 
to add:

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

Thanks,

Bart.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: fix upper bounds check of sense key in scsi_sense_key_string()
  2016-08-09 20:08 ` Bart Van Assche
@ 2016-08-11 21:21   ` Tyrel Datwyler
  0 siblings, 0 replies; 3+ messages in thread
From: Tyrel Datwyler @ 2016-08-11 21:21 UTC (permalink / raw)
  To: Bart Van Assche, Tyrel Datwyler, james.bottomley
  Cc: martin.petersen, linux-scsi

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
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-08-11 21:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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.