Skip to contentSkip to conversation

mtdchar.c: fix different address space noise

PATCH In review H Hartley Sweeten 2 participants 2 messages Jan 15, 2010 – Feb 2, 2010 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtdchar.c: fix different address space noise

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 *.

---

drivers/mtd/mtdchar.c +1 -1
index 5b081cb..0a85085 100644
@@ -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;
#1 lore raw
Quoted 11 lines · H Hartley Sweeten

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>

Quoted 5 lines

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

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

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Артём Битюцкий)