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.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 5dd0b8d72c8b..aa18d45b264b 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -504,12 +504,12 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
504 return ret; 504 return ret;
505 505
506 ops.len = buf.length; 506 ops.len = buf.length;
507 ops.ooblen = mtd->oobsize; 507 ops.ooblen = buf.length;
508 ops.ooboffs = buf.start & (mtd->oobsize - 1); 508 ops.ooboffs = buf.start & (mtd->oobsize - 1);
509 ops.datbuf = NULL; 509 ops.datbuf = NULL;
510 ops.mode = MTD_OOB_PLACE; 510 ops.mode = MTD_OOB_PLACE;
511 511
512 if (ops.ooboffs && ops.len > (ops.ooblen - ops.ooboffs)) 512 if (ops.ooboffs && ops.len > (mtd->oobsize - ops.ooboffs))
513 return -EINVAL; 513 return -EINVAL;
514 514
515 ops.oobbuf = kmalloc(buf.length, GFP_KERNEL); 515 ops.oobbuf = kmalloc(buf.length, GFP_KERNEL);
@@ -553,12 +553,12 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
553 return ret; 553 return ret;
554 554
555 ops.len = buf.length; 555 ops.len = buf.length;
556 ops.ooblen = mtd->oobsize; 556 ops.ooblen = buf.length;
557 ops.ooboffs = buf.start & (mtd->oobsize - 1); 557 ops.ooboffs = buf.start & (mtd->oobsize - 1);
558 ops.datbuf = NULL; 558 ops.datbuf = NULL;
559 ops.mode = MTD_OOB_PLACE; 559 ops.mode = MTD_OOB_PLACE;
560 560
561 if (ops.ooboffs && ops.len > (ops.ooblen - ops.ooboffs)) 561 if (ops.ooboffs && ops.len > (mtd->oobsize - ops.ooboffs))
562 return -EINVAL; 562 return -EINVAL;
563 563
564 ops.oobbuf = kmalloc(buf.length, GFP_KERNEL); 564 ops.oobbuf = kmalloc(buf.length, GFP_KERNEL);