[SCSI] osst: wrong index used in inner loop
authorRoel Kluin <roel.kluin@gmail.com>
Mon, 23 May 2011 22:29:12 +0000 (15:29 -0700)
committerJames Bottomley <jbottomley@parallels.com>
Tue, 24 May 2011 17:08:57 +0000 (13:08 -0400)
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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <jbottomley@parallels.com>
drivers/scsi/osst.c

index 58f5be4740e9af378c7eb44d2786ab8e28367f39..9b79e84f95bb1768aae5c0f1475b9f86552edd86 100644 (file)
@@ -4702,8 +4702,9 @@ static int __os_scsi_tape_open(struct inode * inode, struct file * filp)
                                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;