diff options
author | Sandeep Paulraj <s-paulraj@ti.com> | 2009-11-07 14:25:18 -0500 |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2009-11-13 16:56:16 -0600 |
commit | 5df3c2b62cebaa0ddb2817364f93726e5dbe3525 (patch) | |
tree | ef484fb6a841c028f6684c216505948d07eb9128 | |
parent | 18b5a4b43af3c8359cb568f4fa32d6b9dcebbf26 (diff) |
NAND: Don't walk past end of oobfree[]
When computing oobavail from the list of free areas in the OOB,
don't assume there will always be an unused slot at the end.
This syncs up with the kernel NAND driver.
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 52b0c1a762..cf032a622f 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -2871,7 +2871,8 @@ int nand_scan_tail(struct mtd_info *mtd) * the out of band area */ chip->ecc.layout->oobavail = 0; - for (i = 0; chip->ecc.layout->oobfree[i].length; i++) + for (i = 0; chip->ecc.layout->oobfree[i].length + && i < ARRAY_SIZE(chip->ecc.layout->oobfree); i++) chip->ecc.layout->oobavail += chip->ecc.layout->oobfree[i].length; mtd->oobavail = chip->ecc.layout->oobavail; |