diff options
author | Roel Kluin <roel.kluin@gmail.com> | 2010-08-10 21:01:10 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-11 11:58:59 -0400 |
commit | ef3f7cc41280e9611a837df1fedf3f6d4d921a75 (patch) | |
tree | 63df51b25c2d8e3fb584cbfbe49cb0bdcbd07895 /drivers/scsi/osst.c | |
parent | 13bcbc008790b05413c9a16763b423c206528c0a (diff) |
osst: fix read buffer overflow
Check whether index is within bounds before testing the element.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Willem Riede <osst@riede.org>
Cc: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/scsi/osst.c')
-rw-r--r-- | drivers/scsi/osst.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c index d64b7178fa08..278b352ae78d 100644 --- a/drivers/scsi/osst.c +++ b/drivers/scsi/osst.c | |||
@@ -5868,7 +5868,8 @@ static int osst_probe(struct device *dev) | |||
5868 | } | 5868 | } |
5869 | 5869 | ||
5870 | /* find a free minor number */ | 5870 | /* find a free minor number */ |
5871 | for (i=0; os_scsi_tapes[i] && i<osst_max_dev; i++); | 5871 | for (i = 0; i < osst_max_dev && os_scsi_tapes[i]; i++) |
5872 | ; | ||
5872 | if(i >= osst_max_dev) panic ("Scsi_devices corrupt (osst)"); | 5873 | if(i >= osst_max_dev) panic ("Scsi_devices corrupt (osst)"); |
5873 | dev_num = i; | 5874 | dev_num = i; |
5874 | 5875 | ||