Skip to contentSkip to conversation

Overrun in drivers/scsi/scsi.c

PATCH New Eric Sesterhenn 1 participant 1 message Sep 26, 2006 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Overrun in drivers/scsi/scsi.c

hi,

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

If type == ARRAY_SIZE(scsi_device_types), we are off by one.

drivers/scsi/scsi.c renamed from drivers/scsi/scsi.c.orig +1 -1
@@ -128,7 +128,7 @@ const char * scsi_device_type(unsigned t
 		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];
 }