Skip to contentSkip to conversation

osst: wrong index used in inner loop

PATCH In review [email protected] 1 participant 1 message May 23, 2011 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 3/6 osst: wrong index used in inner loop

From: Roel Kluin <[email protected]>

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

[[email protected]: coding-style fixes]
Cc Willem Riede <[email protected]>
Cc James Bottomley <[email protected]>

---

 drivers/scsi/osst.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/osst.c renamed from drivers/scsi/osst.c~osst-wrong-index-used-in-inner-loop +3 -2
diff -puN drivers/scsi/osst.c~osst-wrong-index-used-in-inner-loop 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;

_