Commit 80c6e3c0 authored by Eric Sesterhenn's avatar Eric Sesterhenn Committed by James Bottomley

[SCSI] fix scsi_device_types overrun in scsi.c

this overrun was spotted by coverity (cid #1403).

If type == ARRAY_SIZE(scsi_device_types), we are off by one.
Signed-off-by: default avatarEric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 7b75b990
...@@ -128,7 +128,7 @@ const char * scsi_device_type(unsigned type) ...@@ -128,7 +128,7 @@ const char * scsi_device_type(unsigned type)
return "Well-known LUN "; return "Well-known LUN ";
if (type == 0x1f) if (type == 0x1f)
return "No Device "; return "No Device ";
if (type > ARRAY_SIZE(scsi_device_types)) if (type >= ARRAY_SIZE(scsi_device_types))
return "Unknown "; return "Unknown ";
return scsi_device_types[type]; return scsi_device_types[type];
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment