[PATCH 3/4] mtd: mxc_nand: fix truncate of unaligned oob copying
Uwe Kleine-König
u.kleine-koenig at pengutronix.de
Sun Apr 26 12:52:11 PDT 2015
Hello Baruch,
On Sun, Apr 26, 2015 at 11:16:50AM +0300, Baruch Siach wrote:
> diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
> index c650f0950b20..c05f5e8fef17 100644
> --- a/drivers/mtd/nand/mxc_nand.c
> +++ b/drivers/mtd/nand/mxc_nand.c
> @@ -840,22 +840,22 @@ static void copy_spare(struct mtd_info *mtd, bool bfrom)
> for (i = 0; i < num_chunks - 1; i++)
> memcpy32_fromio(d + i * oob_chunk_size,
> s + i * sparebuf_size,
> - oob_chunk_size);
> + ALIGN(oob_chunk_size, 4));
If oob_chunk_size isn't 32-bit-aligned, d + i * oob_chunk_size isn't
either for uneven i. That's not nice. I suggest to use memcpy16_fromio.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
More information about the linux-mtd
mailing list