Skip to content

Commit

Permalink
[SCSI] fix scsi_device_types overrun in scsi.c
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Sesterhenn authored and James Bottomley committed Oct 1, 2006
1 parent 7b75b99 commit 80c6e3c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/scsi/scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down

0 comments on commit 80c6e3c

Please sign in to comment.