Commit beda1d49 authored by Artem Bityutskiy's avatar Artem Bityutskiy Committed by David Woodhouse

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

This reverts commit e14feafb.

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: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 4ccb3b44
...@@ -1782,13 +1782,6 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from, ...@@ -1782,13 +1782,6 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
else else
len = mtd->oobsize; 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)) { if (unlikely(ops->ooboffs >= len)) {
DEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt to start read " DEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt to start read "
"outside oob\n", __func__); "outside oob\n", __func__);
...@@ -2384,7 +2377,7 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to, ...@@ -2384,7 +2377,7 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
return -EINVAL; return -EINVAL;
} }
/* Do not allow write past end of device */ /* Do not allow reads past end of device */
if (unlikely(to >= mtd->size || if (unlikely(to >= mtd->size ||
ops->ooboffs + ops->ooblen > ops->ooboffs + ops->ooblen >
((mtd->size >> chip->page_shift) - ((mtd->size >> chip->page_shift) -
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment