提交 81d19b04 编写于 作者: D David Brownell 提交者: David Woodhouse

mtd: nand: don't walk past end of oobfree[]

Resolve issue noted by Sneha:  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.  With ECC_HW_SYNDROME
and 4KiB page chips, it's fairly likely there *won't* be one.
Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
Cc: "Narnakaje, Snehaprabha" <nsnehaprabha@ti.com>"
Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
上级 24430abc
...@@ -2756,7 +2756,8 @@ int nand_scan_tail(struct mtd_info *mtd) ...@@ -2756,7 +2756,8 @@ int nand_scan_tail(struct mtd_info *mtd)
* the out of band area * the out of band area
*/ */
chip->ecc.layout->oobavail = 0; 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->oobavail +=
chip->ecc.layout->oobfree[i].length; chip->ecc.layout->oobfree[i].length;
mtd->oobavail = chip->ecc.layout->oobavail; mtd->oobavail = chip->ecc.layout->oobavail;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册