[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <b0c04f74642bc9c8179a294ef33ee12a5748c919.1475144721.git.jslaby@suse.cz>
Date: Thu, 29 Sep 2016 12:25:03 +0200
From: Jiri Slaby <jslaby@...e.cz>
To: stable@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
Tyrel Datwyler <tyreld@...ux.vnet.ibm.com>,
"Martin K . Petersen" <martin.petersen@...cle.com>,
Jiri Slaby <jslaby@...e.cz>
Subject: [PATCH 3.12 067/119] scsi: fix upper bounds check of sense key in scsi_sense_key_string()
From: Tyrel Datwyler <tyreld@...ux.vnet.ibm.com>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit a87eeb900dbb9f8202f96604d56e47e67c936b9d upstream.
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")
Signed-off-by: Tyrel Datwyler <tyreld@...ux.vnet.ibm.com>
Reviewed-by: Bart Van Assche <bart.vanassche@...disk.com>
Signed-off-by: Martin K. Petersen <martin.petersen@...cle.com>
Signed-off-by: Jiri Slaby <jslaby@...e.cz>
---
drivers/scsi/constants.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index d35a5d6c8d7c..2cde21be80c1 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -1335,9 +1335,10 @@ static const char * const snstext[] = {
/* Get sense key string or NULL if not available */
const char *
-scsi_sense_key_string(unsigned char key) {
+scsi_sense_key_string(unsigned char key)
+{
#ifdef CONFIG_SCSI_CONSTANTS
- if (key <= 0xE)
+ if (key < ARRAY_SIZE(snstext))
return snstext[key];
#endif
return NULL;
--
2.10.0
Powered by blists - more mailing lists