Skip to content

Commit

Permalink
scsi: fix upper bounds check of sense key in scsi_sense_key_string()
Browse files Browse the repository at this point in the history
commit a87eeb9 upstream.

Commit 655ee63 ("scsi constants: command, sense key + additional
sense string") 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: 655ee63 ("[SCSI] scsi constants: command, sense key + additional sense strings")
Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Tyrel Datwyler authored and Greg Kroah-Hartman committed Sep 15, 2016
1 parent 1e6e414 commit 5ef15cd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/scsi/constants.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,9 @@ 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)
scsi_sense_key_string(unsigned char key)
{
if (key < ARRAY_SIZE(snstext))
return snstext[key];
return NULL;
}
Expand Down

0 comments on commit 5ef15cd

Please sign in to comment.