public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Patch] Overrun in drivers/scsi/scsi.c
@ 2006-09-26 11:22 Eric Sesterhenn
  0 siblings, 0 replies; only message in thread
From: Eric Sesterhenn @ 2006-09-26 11:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-scsi

hi,

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>

--- linux-2.6.18-git5/drivers/scsi/scsi.c.orig	2006-09-26 13:18:52.000000000 +0200
+++ linux-2.6.18-git5/drivers/scsi/scsi.c	2006-09-26 13:19:13.000000000 +0200
@@ -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];
 }



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-09-26 11:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-26 11:22 [Patch] Overrun in drivers/scsi/scsi.c Eric Sesterhenn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox