[PATCH] mtd/nand_imx: fix read past buffer end

Baruch Siach baruch at tkos.co.il
Thu Mar 17 04:59:42 EDT 2011


Signed-off-by: Baruch Siach <baruch at tkos.co.il>
---
 drivers/mtd/nand/nand_imx.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/nand_imx.c b/drivers/mtd/nand/nand_imx.c
index 8bfa2ba..48841dc 100644
--- a/drivers/mtd/nand/nand_imx.c
+++ b/drivers/mtd/nand/nand_imx.c
@@ -566,9 +566,9 @@ static void imx_nand_read_buf(struct mtd_info *mtd, u_char * buf, int len)
 
 	n = min(n, len);
 
-	memcpy(buf, host->data_buf + col, len);
+	memcpy(buf, host->data_buf + col, n);
 
-	host->buf_start += len;
+	host->buf_start += n;
 }
 
 /*
-- 
1.7.2.3




More information about the barebox mailing list