aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtdchar.c
diff options
context:
space:
mode:
authorHarvey Harrison <harvey.harrison@gmail.com>2008-07-04 02:40:13 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2008-07-11 09:46:22 -0400
commit5f6928378b165c4b0d57a711e1c1eb925ad33846 (patch)
tree905c6374d4667734689a8cb9adf6c411a32aedec /drivers/mtd/mtdchar.c
parent72289824423655e67993c25c91a7a86a34917209 (diff)
[MTD] mtdchar.c silence sparse warning
The copy_to_user was casting away the address space to get the offset of the length member. Use offsetof() instead and add it to the void __user *argp. drivers/mtd/mtdchar.c:527:23: warning: cast removes address space of expression drivers/mtd/mtdchar.c:527:23: warning: incorrect type in argument 1 (different address spaces) drivers/mtd/mtdchar.c:527:23: expected void [noderef] <asn:1>*to drivers/mtd/mtdchar.c:527:23: got unsigned int *<noident> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/mtdchar.c')
-rw-r--r--drivers/mtd/mtdchar.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 4b3156f9b36f..5fc2c4216c03 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -479,6 +479,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
479 { 479 {
480 struct mtd_oob_buf buf; 480 struct mtd_oob_buf buf;
481 struct mtd_oob_ops ops; 481 struct mtd_oob_ops ops;
482 struct mtd_oob_buf __user *user_buf = argp;
482 uint32_t retlen; 483 uint32_t retlen;
483 484
484 if(!(file->f_mode & 2)) 485 if(!(file->f_mode & 2))
@@ -522,8 +523,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
522 if (ops.oobretlen > 0xFFFFFFFFU) 523 if (ops.oobretlen > 0xFFFFFFFFU)
523 ret = -EOVERFLOW; 524 ret = -EOVERFLOW;
524 retlen = ops.oobretlen; 525 retlen = ops.oobretlen;
525 if (copy_to_user(&((struct mtd_oob_buf *)argp)->length, 526 if (copy_to_user(&user_buf->length, &retlen, sizeof(buf.length)))
526 &retlen, sizeof(buf.length)))
527 ret = -EFAULT; 527 ret = -EFAULT;
528 528
529 kfree(ops.oobbuf); 529 kfree(ops.oobbuf);