Revert "mtd: nand: add check for out of page read"

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Thu Jan 6 10:59:02 EST 2011


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=beda1d49941765c0765e0f3cb95b4a86de67745d
Commit:     beda1d49941765c0765e0f3cb95b4a86de67745d
Parent:     4ccb3b4497ce01fab4933704fe21581e30fda1a5
Author:     Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
AuthorDate: Tue Dec 14 17:07:57 2010 +0200
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Thu Jan 6 15:13:25 2011 +0000

    Revert "mtd: nand: add check for out of page read"
    
    This reverts commit e14feafbe0d5c6d64bb6fe4eba928cb57ac9a4c8.
    
    The commit limits the maximum amount of bytes which can be read
    at one go to the OOB size, which is incorrect, because mtd->read_oob()
    allows reading multiple pages at a time, see comment near
    "struct mtd_oob_ops" at include/linux/mtd/mtd.h. So this patch
    breaks ABI and hence, has to be reverted.
    
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/nand/nand_base.c |    9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 33550c4..9c8da74 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1782,13 +1782,6 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
 	else
 		len = mtd->oobsize;
 
-	/* Do not allow read past end of page */
-	if ((ops->ooboffs + readlen) > len) {
-		DEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt to read "
-				"past end of page\n", __func__);
-		return -EINVAL;
-	}
-
 	if (unlikely(ops->ooboffs >= len)) {
 		DEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt to start read "
 					"outside oob\n", __func__);
@@ -2384,7 +2377,7 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
 		return -EINVAL;
 	}
 
-	/* Do not allow write past end of device */
+	/* Do not allow reads past end of device */
 	if (unlikely(to >= mtd->size ||
 		     ops->ooboffs + ops->ooblen >
 			((mtd->size >> chip->page_shift) -



More information about the linux-mtd-cvs mailing list