Missing offset increment in scan_read_raw_oob()

Artem Bityutskiy dedekind1 at gmail.com
Tue May 15 02:57:52 EDT 2012


On Fri, 2012-05-11 at 20:51 +0300, Dmitry Maluka wrote:
> 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):
> 
> --- a/drivers/mtd/nand/nand_bbt.c
> +++ b/drivers/mtd/nand/nand_bbt.c
> @@ -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;
>  }

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

-- 
Best Regards,
Artem Bityutskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20120515/d2693605/attachment.sig>


More information about the linux-mtd mailing list