Skip to contentSkip to conversation

Missing offset increment in scan_read_raw_oob()

PATCH Dmitry Maluka 2 participants 4 messages May 11, 2012 – May 15, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

It seems there is a bug in scan_read_raw_oob() in nand_bbt.c which should cause wrong functioning of NAND_BBT_SCANALLPAGES option.

Possible fix (relies on offs passed page-aligned):

drivers/mtd/nand/nand_bbt.c +0 -0
@@ -324,6 +324,7 @@ static int scan_read_raw_oob(struct mtd_info *mtd,

uint8_t *buf, loff_t offs,

                buf += mtd->oobsize + mtd->writesize;
                len -= mtd->writesize;
+               offs += mtd->writesize;
        }
        return 0;

}

#1 lore raw
Quoted 15 lines · Dmitry Maluka

It seems there is a bug in scan_read_raw_oob() in nand_bbt.c which should cause wrong functioning of NAND_BBT_SCANALLPAGES option.

Possible fix (relies on offs passed page-aligned):

drivers/mtd/nand/nand_bbt.c +1 -0
@@ -324,6 +324,7 @@ static int scan_read_raw_oob(struct mtd_info *mtd,
 uint8_t *buf, loff_t offs,
 
                buf += mtd->oobsize + mtd->writesize;
                len -= mtd->writesize;
+               offs += mtd->writesize;
        }
        return 0;
Quoted 1 line

}

Looks like a correct fix. Did you encounter a real bug and then spot this issue, or you spot it by reading the code?

Signature · 2 lines
Best Regards,
Artem Bityutskiy
#2 lore raw
In reply to Dmitry Maluka
Quoted 4 lines · Dmitry Maluka

It seems there is a bug in scan_read_raw_oob() in nand_bbt.c which should cause wrong functioning of NAND_BBT_SCANALLPAGES option.

Possible fix (relies on offs passed page-aligned):

I pushed it to l2-mtd.git, but please, tell how you found this issue. Also you did not provide signed-off-by - can I add this:

?

Also note, the patch was line-wrapped and did not apply, so I had to amend it.

Signature · 2 lines
Best Regards,
Artem Bityutskiy
#3 lore raw
Quoted 1 line · Artem Bityutskiy

I pushed it to l2-mtd.git, but please, tell how you found this issue.

Just by reading the code. I do not use NAND_BBT_SCANALLPAGES so I think I couldn't face this bug.

Quoted 8 lines

Also you did not provide signed-off-by - can I add this:

?

Also note, the patch was line-wrapped and did not apply, so I had to amend it.

Ok, no problem.