Skip to content

Commit

Permalink
Revert "mtd: nand: add check for out of page read"
Browse files Browse the repository at this point in the history
This reverts commit e14feaf.

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>
  • Loading branch information
Artem Bityutskiy authored and David Woodhouse committed Jan 6, 2011
1 parent 4ccb3b4 commit beda1d4
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions drivers/mtd/nand/nand_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -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__);
Expand Down Expand Up @@ -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) -
Expand Down

0 comments on commit beda1d4

Please sign in to comment.