mirror of
https://github.com/adulau/aha.git
synced 2024-12-29 04:06:22 +00:00
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: David Brownell <dbrownell@users.sourceforge.net> Cc: "Narnakaje, Snehaprabha" <nsnehaprabha@ti.com>" Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
This commit is contained in:
parent
24430abc88
commit
81d19b04a8
1 changed files with 2 additions and 1 deletions
|
@ -2756,7 +2756,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;
|
||||
|
|
Loading…
Reference in a new issue