NAND: don't walk past end of oobfree[]
Subsystems (2)
PATCH 1/3 NAND: don't walk past end of oobfree[]
From: David Brownell <[email protected]>
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 4KB page chips, it's fairly likely there *won't* be one.
---
RESEND refreshed 7-april version.
Still seems appropriate for a 2.6.30-rc merge.
drivers/mtd/nand/nand_base.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mtd/nand/nand_base.c +2 -1
@@ -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;
Quoted 9 lines · David Brownell
From: David Brownell <[email protected]>
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_SYNDROMEand 4KB page chips, it's fairly likely there *won't* be one.Signed-off-by David Brownell <[email protected]>Cc "Narnakaje, Snehaprabha" <[email protected]>"
Hi,
not that I tested your stuff, but it looks OK for me. So I've added the series to my l2-mtd tree, which means I'll ping dwmw2 about pulling it at some point. No guarantees, though.
Signature · 2 lines
Best regards, Artem Bityutskiy (Битюцкий Артём)