summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/constants.c
diff options
context:
space:
mode:
authorTyrel Datwyler <tyreld@linux.vnet.ibm.com>2016-08-13 00:20:07 +0200
committerMartin K. Petersen <martin.petersen@oracle.com>2016-08-16 06:49:32 +0200
commita87eeb900dbb9f8202f96604d56e47e67c936b9d (patch)
tree504de8af767fbc32dcd8206a755b03544bd44690 /drivers/scsi/constants.c
parentses: Fix racy cleanup of /sys in remove_dev() (diff)
downloadlinux-a87eeb900dbb9f8202f96604d56e47e67c936b9d.tar.xz
linux-a87eeb900dbb9f8202f96604d56e47e67c936b9d.zip
scsi: fix upper bounds check of sense key in scsi_sense_key_string()
Commit 655ee63cf371 ("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: 655ee63cf371 ("[SCSI] scsi constants: command, sense key + additional sense strings") Cc: <stable@vger.kernel.org> # v3.12+ 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>
Diffstat (limited to 'drivers/scsi/constants.c')
-rw-r--r--drivers/scsi/constants.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index 83458f7a2824..6dc96c8dfe75 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -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;
}