Skip to contentSkip to conversation

mtd: nand: omap2: Fix oobfree offset

PATCH In review Teresa Gámez 2 participants 2 messages Jul 19, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: nand: omap2: Fix oobfree offset

The calculation of the oobfree[0].offset is wrong when using BCH8 and elm.

The layout->eccbytes is already steps*info->nand.ecc.bytes. The second multiplication with steps is too much and will create a value larger than the oob area.

Fixed the calculation.

---
 drivers/mtd/nand/omap2.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mtd/nand/omap2.c +1 -1
index 81b80af..922706b 100644
@@ -1790,7 +1790,7 @@ static int omap3_init_bch_tail(struct mtd_info *mtd)
 		layout->eccpos[i] = offset + i;
 
 	if (info->is_elm_used && (info->nand.ecc.bytes == BCH8_SIZE))
-		layout->oobfree[0].offset = 2 + layout->eccbytes * steps;
+		layout->oobfree[0].offset = 2 + layout->eccbytes;
 	else
 		layout->oobfree[0].offset = 2;
 
Signature · 6 lines
1.7.0.4


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
#1 lore raw
Quoted 10 lines

The calculation of the oobfree[0].offset is wrong when using BCH8 and elm.

The layout->eccbytes is already steps*info->nand.ecc.bytes. The second multiplication with steps is too much and will create a value larger than the oob area.

Fixed the calculation.

This is already fixed in
http://lists.infradead.org/pipermail/linux-mtd/2013-July/047534.html

Can you please pull-in the whole series, and test it ?
http://lists.infradead.org/pipermail/linux-mtd/2013-July/047530.html

with regards, pekon