aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/mtdchar.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 55f0961103a7..287ff0d35848 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -452,13 +452,8 @@ static int mtdchar_readoob(struct file *file, struct mtd_info *mtd,
452 if (length > 4096) 452 if (length > 4096)
453 return -EINVAL; 453 return -EINVAL;
454 454
455 if (!mtd->read_oob) 455 if (!access_ok(VERIFY_WRITE, ptr, length))
456 ret = -EOPNOTSUPP; 456 return -EFAULT;
457 else
458 ret = access_ok(VERIFY_WRITE, ptr,
459 length) ? 0 : -EFAULT;
460 if (ret)
461 return ret;
462 457
463 ops.ooblen = length; 458 ops.ooblen = length;
464 ops.ooboffs = start & (mtd->writesize - 1); 459 ops.ooboffs = start & (mtd->writesize - 1);