Check whether index is within bounds before testing the element. Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx> --- diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c index acb8358..ddb3d06 100644 --- a/drivers/scsi/osst.c +++ b/drivers/scsi/osst.c @@ -5860,7 +5860,8 @@ static int osst_probe(struct device *dev) } /* find a free minor number */ - for (i=0; os_scsi_tapes[i] && i<osst_max_dev; i++); + for (i = 0; i < osst_max_dev && os_scsi_tapes[i]; i++) + ; if(i >= osst_max_dev) panic ("Scsi_devices corrupt (osst)"); dev_num = i; -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html