Message ID | 1471040407-5325-1-git-send-email-tyreld@linux.vnet.ibm.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers | show |
>>>>> "Tyrel" == Tyrel Datwyler <tyreld@linux.vnet.ibm.com> writes:
Tyrel> Commit 655ee63cf371 added a "Completed" sense string with key 0xF
Tyrel> to snstext[], but failed to updated the upper bounds check of the
Tyrel> sense key in scsi_sense_key_string().
Applied to 4.8/scsi-fixes.
diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index 83458f7..6dc96c8 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; }