mtd: mxc_nand: fix read past buffer end
authorBaruch Siach <baruch@tkos.co.il>
Wed, 2 Mar 2011 14:47:55 +0000 (16:47 +0200)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Fri, 11 Mar 2011 14:22:49 +0000 (14:22 +0000)
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

index ef932ba..6cd78ed 100644 (file)
@@ -641,9 +641,9 @@ static void mxc_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;
 }
 
 /* Used by the upper layer to verify the data in NAND Flash