浏览代码

[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 <snakebyte@gmx.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Eric Sesterhenn 19 年之前
父节点
当前提交
80c6e3c0b5
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      drivers/scsi/scsi.c

+ 1 - 1
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];
 }