public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] mtd/mxc_nand: fix read past buffer end
@ 2011-03-02 14:47 Baruch Siach
  2011-03-02 15:02 ` Sascha Hauer
  2011-03-07  9:29 ` Artem Bityutskiy
  0 siblings, 2 replies; 4+ messages in thread
From: Baruch Siach @ 2011-03-02 14:47 UTC (permalink / raw)
  To: linux-mtd; +Cc: Baruch Siach, Sascha Hauer

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

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mtd/mxc_nand: fix read past buffer end
  2011-03-02 14:47 [PATCH] mtd/mxc_nand: fix read past buffer end Baruch Siach
@ 2011-03-02 15:02 ` Sascha Hauer
  2011-03-02 15:06   ` Baruch Siach
  2011-03-07  9:29 ` Artem Bityutskiy
  1 sibling, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2011-03-02 15:02 UTC (permalink / raw)
  To: Baruch Siach; +Cc: linux-mtd, Sascha Hauer

On Wed, Mar 02, 2011 at 04:47:55PM +0200, Baruch Siach wrote:
> Signed-off-by: Baruch Siach <baruch@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@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 |

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mtd/mxc_nand: fix read past buffer end
  2011-03-02 15:02 ` Sascha Hauer
@ 2011-03-02 15:06   ` Baruch Siach
  0 siblings, 0 replies; 4+ messages in thread
From: Baruch Siach @ 2011-03-02 15:06 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: linux-mtd, Sascha Hauer

Hi Sascha,

On Wed, Mar 02, 2011 at 04:02:35PM +0100, Sascha Hauer wrote:
> On Wed, Mar 02, 2011 at 04:47:55PM +0200, Baruch Siach wrote:
> > Signed-off-by: Baruch Siach <baruch@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.

I found it by looking at the code. This doesn't fix my actual problem (wrong 
oob read and/or write with flash of page size 4K+218).

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

Thanks,
baruch

> > 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

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mtd/mxc_nand: fix read past buffer end
  2011-03-02 14:47 [PATCH] mtd/mxc_nand: fix read past buffer end Baruch Siach
  2011-03-02 15:02 ` Sascha Hauer
@ 2011-03-07  9:29 ` Artem Bityutskiy
  1 sibling, 0 replies; 4+ messages in thread
From: Artem Bityutskiy @ 2011-03-07  9:29 UTC (permalink / raw)
  To: Baruch Siach; +Cc: linux-mtd, Sascha Hauer

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

Pushed to l2-mtd-2.6.git, thank you!

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-03-07  9:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-02 14:47 [PATCH] mtd/mxc_nand: fix read past buffer end Baruch Siach
2011-03-02 15:02 ` Sascha Hauer
2011-03-02 15:06   ` Baruch Siach
2011-03-07  9:29 ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox