[PATCH] [MTD] OneNAND: Do not allow oob write past end of page

Kyungmin Park kmpark at infradead.org
Mon Feb 5 01:38:32 EST 2007


Hi Adrian

Umm Why is it required in OneNAND? Even though OneNAND is based on NAND. We
regard it as NOR
So we don't need this patch.

Thank you,
Kyungmin Park

> -----Original Message-----
> From: linux-mtd-bounces at lists.infradead.org 
> [mailto:linux-mtd-bounces at lists.infradead.org] On Behalf Of 
> Adrian Hunter
> Sent: Friday, February 02, 2007 4:55 PM
> To: linux-mtd at lists.infradead.org
> Subject: [PATCH] [MTD] OneNAND: Do not allow oob write past 
> end of page
> 
> >From ba01b89188f21ca9a982e33452217e5c6874fd0b Mon Sep 17 
> 00:00:00 2001
> From: Adrian Hunter <ext-adrian.hunter at nokia.com>
> Date: Thu, 1 Feb 2007 16:04:50 +0200
> Subject: [MTD] OneNAND: Do not allow oob write past end of page
> 
> OneNAND can write oob to successive pages, but NAND does not 
> do that.  For compatibility, disallow OneNAND from writing 
> past the end of the page.
> 
> Signed-off-by: Adrian Hunter <ext-adrian.hunter at nokia.com>
> ---
>  drivers/mtd/onenand/onenand_base.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mtd/onenand/onenand_base.c 
> b/drivers/mtd/onenand/onenand_base.c
> index 9ec28bb..b7da84a 100644
> --- a/drivers/mtd/onenand/onenand_base.c
> +++ b/drivers/mtd/onenand/onenand_base.c
> @@ -1191,6 +1191,13 @@ static int onenand_do_write_oob(struct m
>  		return -EINVAL;
>  	}
>  
> +	/* For compatibility with NAND: Do not allow write past 
> end of page */
> +	if (column + len > oobsize) {
> +		DEBUG(MTD_DEBUG_LEVEL0, "onenand_write_oob: "
> +		      "Attempt to write past end of page\n");
> +		return -EINVAL;
> +	}
> +
>  	/* Do not allow reads past end of device */
>  	if (unlikely(to >= mtd->size ||
>  		     column + len > ((mtd->size >> this->page_shift) -
> --
> 1.4.3
> 
> 
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
> 
> 





More information about the linux-mtd mailing list