Commit 408b483d authored by Thomas Gleixner's avatar Thomas Gleixner Committed by David Woodhouse

[MTD] Fix length comparison in MEMREADOOB

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: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
parent 1cf9827b
...@@ -553,7 +553,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file, ...@@ -553,7 +553,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
ops.datbuf = NULL; ops.datbuf = NULL;
ops.mode = MTD_OOB_PLACE; 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; return -EINVAL;
ops.oobbuf = kmalloc(buf.length, GFP_KERNEL); ops.oobbuf = kmalloc(buf.length, GFP_KERNEL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment