[PATCH] mtd: nand: omap2: Fix oobfree offset

Teresa Gámez t.gamez at phytec.de
Fri Jul 19 05:13:22 EDT 2013


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.

Signed-off-by: Teresa Gámez <t.gamez at phytec.de>
---
 drivers/mtd/nand/omap2.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index 81b80af..922706b 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -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;
 
-- 
1.7.0.4




More information about the linux-mtd mailing list