]> err.no Git - linux-2.6/commitdiff
[SCSI] fix scsi_device_types overrun in scsi.c
authorEric Sesterhenn <snakebyte@gmx.de>
Tue, 26 Sep 2006 11:22:13 +0000 (13:22 +0200)
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>
Sun, 1 Oct 2006 20:04:48 +0000 (15:04 -0500)
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 <snakebyte@gmx.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/scsi.c

index 7a054f9d1ee38230a7b59344e3e791d217f46d79..a21642e32c42769e6c396f85ecf0fb617c988e0a 100644 (file)
@@ -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];
 }