aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-12-14 10:07:57 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2011-01-06 10:13:25 -0500
commitbeda1d49941765c0765e0f3cb95b4a86de67745d (patch)
tree285df96da600a384a86ca30a642d64bc52afe668 /drivers/mtd
parent4ccb3b4497ce01fab4933704fe21581e30fda1a5 (diff)
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@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/nand_base.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 33550c43acc2..9c8da741dce0 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,
1782 else 1782 else
1783 len = mtd->oobsize; 1783 len = mtd->oobsize;
1784 1784
1785 /* Do not allow read past end of page */
1786 if ((ops->ooboffs + readlen) > len) {
1787 DEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt to read "
1788 "past end of page\n", __func__);
1789 return -EINVAL;
1790 }
1791
1792 if (unlikely(ops->ooboffs >= len)) { 1785 if (unlikely(ops->ooboffs >= len)) {
1793 DEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt to start read " 1786 DEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt to start read "
1794 "outside oob\n", __func__); 1787 "outside oob\n", __func__);
@@ -2384,7 +2377,7 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
2384 return -EINVAL; 2377 return -EINVAL;
2385 } 2378 }
2386 2379
2387 /* Do not allow write past end of device */ 2380 /* Do not allow reads past end of device */
2388 if (unlikely(to >= mtd->size || 2381 if (unlikely(to >= mtd->size ||
2389 ops->ooboffs + ops->ooblen > 2382 ops->ooboffs + ops->ooblen >
2390 ((mtd->size >> chip->page_shift) - 2383 ((mtd->size >> chip->page_shift) -