mtd: mxc_nand: fix OOB corruption when page size > 2KiB
authorBaruch Siach <baruch@tkos.co.il>
Wed, 9 Mar 2011 14:12:20 +0000 (16:12 +0200)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Fri, 11 Mar 2011 14:23:48 +0000 (14:23 +0000)
commit2c1c5f199482356c00f70b6f2f368c3455d1230c
treec2f59799e1e9d510980539de6ee998ac937bd5e4
parentf43272c482661bc88347bba237976eecfc1dbf5b
mtd: mxc_nand: fix OOB corruption when page size > 2KiB

When page size is 4KiB, ecc.total is set to 8*9, and this causes
nand_write_page_hwecc() to read past the initialized part of the eccpos array,
which corrupts chip->oob_poi with bogus values from ecc_calc.

Fix this by creating a proper nand_ecclayout for 4KiB flashes.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/nand/mxc_nand.c