Skip to content

Commit c12ec0a

Browse files
RoelKluinJens Axboe
authored andcommitted
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>
1 parent 39ad2bb commit c12ec0a

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎drivers/block/paride/pcd.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,11 @@ static int pcd_wait(struct pcd_unit *cd, int go, int stop, char *fun, char *msg)
341341
&& (j++ < PCD_SPIN))
342342
udelay(PCD_DELAY);
343343

344-
if ((r & (IDE_ERR & stop)) || (j >= PCD_SPIN)) {
344+
if ((r & (IDE_ERR & stop)) || (j > PCD_SPIN)) {
345345
s = read_reg(cd, 7);
346346
e = read_reg(cd, 1);
347347
p = read_reg(cd, 2);
348-
if (j >= PCD_SPIN)
348+
if (j > PCD_SPIN)
349349
e |= 0x100;
350350
if (fun)
351351
printk("%s: %s %s: alt=0x%x stat=0x%x err=0x%x"

‎drivers/block/paride/pf.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,11 +391,11 @@ static int pf_wait(struct pf_unit *pf, int go, int stop, char *fun, char *msg)
391391
&& (j++ < PF_SPIN))
392392
udelay(PF_SPIN_DEL);
393393

394-
if ((r & (STAT_ERR & stop)) || (j >= PF_SPIN)) {
394+
if ((r & (STAT_ERR & stop)) || (j > PF_SPIN)) {
395395
s = read_reg(pf, 7);
396396
e = read_reg(pf, 1);
397397
p = read_reg(pf, 2);
398-
if (j >= PF_SPIN)
398+
if (j > PF_SPIN)
399399
e |= 0x100;
400400
if (fun)
401401
printk("%s: %s %s: alt=0x%x stat=0x%x err=0x%x"

‎drivers/block/paride/pt.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,11 @@ static int pt_wait(struct pt_unit *tape, int go, int stop, char *fun, char *msg)
274274
&& (j++ < PT_SPIN))
275275
udelay(PT_SPIN_DEL);
276276

277-
if ((r & (STAT_ERR & stop)) || (j >= PT_SPIN)) {
277+
if ((r & (STAT_ERR & stop)) || (j > PT_SPIN)) {
278278
s = read_reg(pi, 7);
279279
e = read_reg(pi, 1);
280280
p = read_reg(pi, 2);
281-
if (j >= PT_SPIN)
281+
if (j > PT_SPIN)
282282
e |= 0x100;
283283
if (fun)
284284
printk("%s: %s %s: alt=0x%x stat=0x%x err=0x%x"

0 commit comments

Comments
 (0)