summaryrefslogtreecommitdiff
path: root/drivers/mtd/mtdcore.c
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@free-electrons.com>2017-12-18 10:26:28 +0300
committerRichard Weinberger <richard@nod.at>2017-12-18 11:16:35 +0300
commitd82c3682168431d29ba1741d0cd5ef45c68bf8e0 (patch)
treec2e6ab78c76f4abc9697989e05494b249fb6b5f1 /drivers/mtd/mtdcore.c
parent9ec4c8e810588ddf6a4a2ebd501cf6cc18c97ad0 (diff)
downloadlinux-d82c3682168431d29ba1741d0cd5ef45c68bf8e0.tar.xz
mtd: Fix mtd_check_oob_ops()
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: 5cdd929da53d ("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>
Diffstat (limited to 'drivers/mtd/mtdcore.c')
-rw-r--r--drivers/mtd/mtdcore.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index f80e911b8843..73b605577447 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -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) {