aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicard Wanderlöf <ricard.wanderlof@axis.com>2006-10-17 11:27:11 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2006-10-21 11:33:17 -0400
commitd25ade71ef80e6312b3e0b53583db518ebb11798 (patch)
treed7813968fe4475804935e7dca3d8c58388c38785
parent42cb1403af8a755b3dfebeb9d2a5f73bc48832a1 (diff)
[MTD] mtdchar: Fix MEMGETOOBSEL and ECCGETLAYOUT ioctls
1. The ECCGETLAYOUT ioctl copy_to_user() call has a superfluous '&' causing the resulting information to be garbage rather than the intended mtd->ecclayout. 2. The MEMGETOOBSEL misses copying mtd->ecclayout->eccbytes so the resulting field of the returned structure contains garbage. Signed-off-by: Ricard Wanderlöf <ricardw@axis.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
-rw-r--r--drivers/mtd/mtdchar.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 5b6acfcb2b88..866c8e0d57e4 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -616,6 +616,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
616 memcpy(&oi.eccpos, mtd->ecclayout->eccpos, sizeof(oi.eccpos)); 616 memcpy(&oi.eccpos, mtd->ecclayout->eccpos, sizeof(oi.eccpos));
617 memcpy(&oi.oobfree, mtd->ecclayout->oobfree, 617 memcpy(&oi.oobfree, mtd->ecclayout->oobfree,
618 sizeof(oi.oobfree)); 618 sizeof(oi.oobfree));
619 oi.eccbytes = mtd->ecclayout->eccbytes;
619 620
620 if (copy_to_user(argp, &oi, sizeof(struct nand_oobinfo))) 621 if (copy_to_user(argp, &oi, sizeof(struct nand_oobinfo)))
621 return -EFAULT; 622 return -EFAULT;
@@ -715,7 +716,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
715 if (!mtd->ecclayout) 716 if (!mtd->ecclayout)
716 return -EOPNOTSUPP; 717 return -EOPNOTSUPP;
717 718
718 if (copy_to_user(argp, &mtd->ecclayout, 719 if (copy_to_user(argp, mtd->ecclayout,
719 sizeof(struct nand_ecclayout))) 720 sizeof(struct nand_ecclayout)))
720 return -EFAULT; 721 return -EFAULT;
721 break; 722 break;