linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 3/6] osst: wrong index used in inner loop
@ 2011-05-23 22:29 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2011-05-23 22:29 UTC (permalink / raw)
  To: James.Bottomley; +Cc: linux-scsi, akpm, roel.kluin, osst

From: Roel Kluin <roel.kluin@gmail.com>

Index i was already used in the outer loop.  Fixes a potentially-infinite
loop.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Willem Riede <osst@riede.org>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/scsi/osst.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff -puN drivers/scsi/osst.c~osst-wrong-index-used-in-inner-loop drivers/scsi/osst.c
--- a/drivers/scsi/osst.c~osst-wrong-index-used-in-inner-loop
+++ a/drivers/scsi/osst.c
@@ -4702,8 +4702,9 @@ static int __os_scsi_tape_open(struct in
 				STp->partition = STp->new_partition = 0;
 				if (STp->can_partitions)
 					STp->nbr_partitions = 1;  /* This guess will be updated later if necessary */
-				for (i=0; i < ST_NBR_PARTITIONS; i++) {
-					STps = &(STp->ps[i]);
+				int j;
+				for (j = 0; j < ST_NBR_PARTITIONS; j++) {
+					STps = &(STp->ps[j]);
 					STps->rw = ST_IDLE;
 					STps->eof = ST_NOEOF;
 					STps->at_sm = 0;
_

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-05-23 22:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-23 22:29 [patch 3/6] osst: wrong index used in inner loop akpm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).