瀏覽代碼

paride: fix off-by-one test

With `while (j++ < PX_SPIN)' j reaches PX_SPIN + 1 after the loop.  This
is probably unlikely to produce a problem.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Roel Kluin 15 年之前
父節點
當前提交
c12ec0a2d9
共有 3 個文件被更改,包括 6 次插入6 次删除
  1. 2 2
      drivers/block/paride/pcd.c
  2. 2 2
      drivers/block/paride/pf.c
  3. 2 2
      drivers/block/paride/pt.c

+ 2 - 2
drivers/block/paride/pcd.c

@@ -341,11 +341,11 @@ static int pcd_wait(struct pcd_unit *cd, int go, int stop, char *fun, char *msg)
 	       && (j++ < PCD_SPIN))
 	       && (j++ < PCD_SPIN))
 		udelay(PCD_DELAY);
 		udelay(PCD_DELAY);
 
 
-	if ((r & (IDE_ERR & stop)) || (j >= PCD_SPIN)) {
+	if ((r & (IDE_ERR & stop)) || (j > PCD_SPIN)) {
 		s = read_reg(cd, 7);
 		s = read_reg(cd, 7);
 		e = read_reg(cd, 1);
 		e = read_reg(cd, 1);
 		p = read_reg(cd, 2);
 		p = read_reg(cd, 2);
-		if (j >= PCD_SPIN)
+		if (j > PCD_SPIN)
 			e |= 0x100;
 			e |= 0x100;
 		if (fun)
 		if (fun)
 			printk("%s: %s %s: alt=0x%x stat=0x%x err=0x%x"
 			printk("%s: %s %s: alt=0x%x stat=0x%x err=0x%x"

+ 2 - 2
drivers/block/paride/pf.c

@@ -391,11 +391,11 @@ static int pf_wait(struct pf_unit *pf, int go, int stop, char *fun, char *msg)
 	       && (j++ < PF_SPIN))
 	       && (j++ < PF_SPIN))
 		udelay(PF_SPIN_DEL);
 		udelay(PF_SPIN_DEL);
 
 
-	if ((r & (STAT_ERR & stop)) || (j >= PF_SPIN)) {
+	if ((r & (STAT_ERR & stop)) || (j > PF_SPIN)) {
 		s = read_reg(pf, 7);
 		s = read_reg(pf, 7);
 		e = read_reg(pf, 1);
 		e = read_reg(pf, 1);
 		p = read_reg(pf, 2);
 		p = read_reg(pf, 2);
-		if (j >= PF_SPIN)
+		if (j > PF_SPIN)
 			e |= 0x100;
 			e |= 0x100;
 		if (fun)
 		if (fun)
 			printk("%s: %s %s: alt=0x%x stat=0x%x err=0x%x"
 			printk("%s: %s %s: alt=0x%x stat=0x%x err=0x%x"

+ 2 - 2
drivers/block/paride/pt.c

@@ -274,11 +274,11 @@ static int pt_wait(struct pt_unit *tape, int go, int stop, char *fun, char *msg)
 	       && (j++ < PT_SPIN))
 	       && (j++ < PT_SPIN))
 		udelay(PT_SPIN_DEL);
 		udelay(PT_SPIN_DEL);
 
 
-	if ((r & (STAT_ERR & stop)) || (j >= PT_SPIN)) {
+	if ((r & (STAT_ERR & stop)) || (j > PT_SPIN)) {
 		s = read_reg(pi, 7);
 		s = read_reg(pi, 7);
 		e = read_reg(pi, 1);
 		e = read_reg(pi, 1);
 		p = read_reg(pi, 2);
 		p = read_reg(pi, 2);
-		if (j >= PT_SPIN)
+		if (j > PT_SPIN)
 			e |= 0x100;
 			e |= 0x100;
 		if (fun)
 		if (fun)
 			printk("%s: %s %s: alt=0x%x stat=0x%x err=0x%x"
 			printk("%s: %s %s: alt=0x%x stat=0x%x err=0x%x"