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

Sascha Hauer s.hauer at pengutronix.de
Wed Mar 2 10:02:35 EST 2011


On Wed, Mar 02, 2011 at 04:47:55PM +0200, Baruch Siach wrote:
> Signed-off-by: Baruch Siach <baruch at tkos.co.il>
> ---
>  drivers/mtd/nand/mxc_nand.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)

Looks good to me. Did you stumble upon this by accident or did something
break? If yes, would be good to have it in the commit log.

Otherwise:

Acked-by: Sascha hauer <s.hauer at pengutronix.de>


> 
> diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
> index 7b33811..466d7a9 100644
> --- a/drivers/mtd/nand/mxc_nand.c
> +++ b/drivers/mtd/nand/mxc_nand.c
> @@ -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
> -- 
> 1.7.2.3
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the linux-mtd mailing list