Skip to content

Commit

Permalink
mtd: Fix mtd_check_oob_ops()
Browse files Browse the repository at this point in the history
The mtd_check_oob_ops() helper verifies if the operation defined by the
user is correct.

Fix the check that verifies if the entire requested area exists. This
check is too restrictive and will fail anytime the last data byte of the
very last page is included in an operation.

Fixes: 5cdd929 ("mtd: Add sanity checks in mtd_write/read_oob()")
Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
  • Loading branch information
Miquel Raynal authored and Richard Weinberger committed Dec 18, 2017
1 parent 9ec4c8e commit d82c368
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/mtd/mtdcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ static int mtd_check_oob_ops(struct mtd_info *mtd, loff_t offs,
if (!ops->oobbuf)
ops->ooblen = 0;

if (offs < 0 || offs + ops->len >= mtd->size)
if (offs < 0 || offs + ops->len > mtd->size)
return -EINVAL;

if (ops->ooblen) {
Expand Down

0 comments on commit d82c368

Please sign in to comment.