From: Eric Sesterhenn Date: Tue, 26 Sep 2006 11:22:13 +0000 (+0200) Subject: [SCSI] fix scsi_device_types overrun in scsi.c X-Git-Tag: v2.6.19-rc1~4^2~33 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80c6e3c0b5eb855b69270658318f5ccf04d7b1ff;p=linux-2.6 [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: Eric Sesterhenn Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 7a054f9d1e..a21642e32c 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -128,7 +128,7 @@ const char * scsi_device_type(unsigned type) return "Well-known LUN "; if (type == 0x1f) return "No Device "; - if (type > ARRAY_SIZE(scsi_device_types)) + if (type >= ARRAY_SIZE(scsi_device_types)) return "Unknown "; return scsi_device_types[type]; }