From: akpm@linux-foundation.org Subject: [patch 02/27] osst: fix read buffer overflow Date: Tue, 20 Jul 2010 15:28:42 -0700 Message-ID: <201007202228.o6KMSgPe021711@imap1.linux-foundation.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Return-path: Received: from smtp1.linux-foundation.org ([140.211.169.13]:59018 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932070Ab0GTW3F (ORCPT ); Tue, 20 Jul 2010 18:29:05 -0400 Sender: linux-scsi-owner@vger.kernel.org List-Id: linux-scsi@vger.kernel.org To: James.Bottomley@HansenPartnership.com Cc: linux-scsi@vger.kernel.org, akpm@linux-foundation.org, roel.kluin@gmail.com, osst@riede.org From: Roel Kluin Check whether index is within bounds before testing the element. Signed-off-by: Roel Kluin Cc: Willem Riede Cc: James E.J. Bottomley Signed-off-by: Andrew Morton --- drivers/scsi/osst.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff -puN drivers/scsi/osst.c~osst-fix-read-buffer-overflow drivers/scsi/osst.c --- a/drivers/scsi/osst.c~osst-fix-read-buffer-overflow +++ a/drivers/scsi/osst.c @@ -5868,7 +5868,8 @@ static int osst_probe(struct device *dev } /* find a free minor number */ - for (i=0; os_scsi_tapes[i] && i= osst_max_dev) panic ("Scsi_devices corrupt (osst)"); dev_num = i; _