Skip to content

Commit

Permalink
[MTD] Fix length comparison in MEMREADOOB
Browse files Browse the repository at this point in the history
The ops.len member is not initialized, because it is unused for this
operation. The length check needs to use ops.ooblen instead

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
  • Loading branch information
Thomas Gleixner authored and David Woodhouse committed Apr 17, 2007
1 parent 1cf9827 commit 408b483
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/mtd/mtdchar.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
ops.datbuf = NULL;
ops.mode = MTD_OOB_PLACE;

if (ops.ooboffs && ops.len > (mtd->oobsize - ops.ooboffs))
if (ops.ooboffs && ops.ooblen > (mtd->oobsize - ops.ooboffs))
return -EINVAL;

ops.oobbuf = kmalloc(buf.length, GFP_KERNEL);
Expand Down

0 comments on commit 408b483

Please sign in to comment.