diff mbox

mtdchar.c: fix different address space noise

Message ID 201001151125.39100.hartleys@visionengravers.com
State Accepted
Commit bcc98a46eafd38968b05e793326f031988c2b2a8
Headers show

Commit Message

Hartley Sweeten Jan. 15, 2010, 6:25 p.m. UTC
mtdchar.c: fix different address space noise

In mtd_ioctl MEMGETREGIONINFO the region_user_info pointer ur
is cast in __kernel space. This produces a number of sparse warnings
like:

warning: cast removes address space of expression
warning: incorrect type in initializer (different address spaces)
   expected unsigned int const [noderef] <asn:1>*register __p
   got unsigned int *<noident>

Since argp is already a void __user * just use it dirrectly without
the cast and make ur a __user *.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: David Woodhouse <dwmw2@infradead.org>

---

Comments

Artem Bityutskiy Feb. 2, 2010, 5:58 a.m. UTC | #1
On Fri, 2010-01-15 at 11:25 -0700, H Hartley Sweeten wrote:
> mtdchar.c: fix different address space noise
> 
> In mtd_ioctl MEMGETREGIONINFO the region_user_info pointer ur
> is cast in __kernel space. This produces a number of sparse warnings
> like:
> 
> warning: cast removes address space of expression
> warning: incorrect type in initializer (different address spaces)
>    expected unsigned int const [noderef] <asn:1>*register __p
>    got unsigned int *<noident>
> 
> Since argp is already a void __user * just use it dirrectly without
> the cast and make ur a __user *.
> 
> Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
> Cc: David Woodhouse <dwmw2@infradead.org>

Pushed this one to my l2-mtd-2.6 / master
diff mbox

Patch

diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 5b081cb..0a85085 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -482,7 +482,7 @@  static int mtd_ioctl(struct inode *inode, struct file *file,
 	{
 		uint32_t ur_idx;
 		struct mtd_erase_region_info *kr;
-		struct region_info_user *ur = (struct region_info_user *) argp;
+		struct region_info_user __user *ur = argp;
 
 		if (get_user(ur_idx, &(ur->regionindex)))
 			return -EFAULT;