aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtdchar.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/mtdchar.c')
-rw-r--r--drivers/mtd/mtdchar.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 1d981a5c1b13..5895de7018d4 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -546,6 +546,9 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg)
546 if (get_user(ur_idx, &(ur->regionindex))) 546 if (get_user(ur_idx, &(ur->regionindex)))
547 return -EFAULT; 547 return -EFAULT;
548 548
549 if (ur_idx >= mtd->numeraseregions)
550 return -EINVAL;
551
549 kr = &(mtd->eraseregions[ur_idx]); 552 kr = &(mtd->eraseregions[ur_idx]);
550 553
551 if (put_user(kr->offset, &(ur->offset)) 554 if (put_user(kr->offset, &(ur->offset))