Skip to contentSkip to conversation

staging: vt6655: ioctl.c - missing __user annotation

PATCH In review Anil Belur 3 participants 4 messages Jul 30, 2014 – Jul 31, 2014 Staging

lore
Share & tools
lore

Anil Belur

author
#0 lore raw

PATCH v3 1/1 staging: vt6655: ioctl.c - missing __user annotation

- private_ioctl() internally calls copy_{to,from}_user() and does not use '__user' which gives out several sparse warnings
- these sparse warnings were fixed by adding __user annotation to the data member of struct tagSCmdRequest:

drivers/staging/vt6655/ioctl.c:78:51: warning: incorrect type in argument 2 (different address spaces)
drivers/staging/vt6655/ioctl.c:78:51: expected void const [noderef] asn:1>*from
drivers/staging/vt6655/ioctl.c:78:51: got void *data

---
v2:
- replaced the 'void __user *' casts by adding '__user' annotation to the data member of struct tagSCmdRequest which is much cleaner approach as suggested by [email protected]
v1:
- added 'void __user *' casts to supress the warnings

 drivers/staging/vt6655/iocmd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6655/iocmd.h +1 -1
index e499f1b..dd12498 100644
@@ -100,7 +100,7 @@ typedef enum tagWZONETYPE {
 #pragma pack(1)
 typedef struct tagSCmdRequest {
 	u8	    name[16];
-	void	*data;
+	void __user *data;
 	u16	    wResult;
 	u16     wCmdCode;
 } SCmdRequest, *PSCmdRequest;
Signature · 1 line
1.9.1
#1 lore raw
Quoted 10 lines · Anil Belur

- private_ioctl() internally calls copy_{to,from}_user() and does not use '__user' which gives out several sparse warnings
- these sparse warnings were fixed by adding __user annotation to the data member of struct tagSCmdRequest:

drivers/staging/vt6655/ioctl.c:78:51: warning: incorrect type in argument 2 (different address spaces)
drivers/staging/vt6655/ioctl.c:78:51: expected void const [noderef] asn:1>*from
drivers/staging/vt6655/ioctl.c:78:51: got void *data

Looks very nice now.

regards,
dan carpenter

maintainer
#2 lore raw
In reply to Anil Belur
Quoted 25 lines · Anil Belur

- private_ioctl() internally calls copy_{to,from}_user() and does not use '__user' which gives out several sparse warnings
- these sparse warnings were fixed by adding __user annotation to the data member of struct tagSCmdRequest:

drivers/staging/vt6655/ioctl.c:78:51: warning: incorrect type in argument 2 (different address spaces)
drivers/staging/vt6655/ioctl.c:78:51: expected void const [noderef] asn:1>*from
drivers/staging/vt6655/ioctl.c:78:51: got void *data

---
v2:
- replaced the 'void __user *' casts by adding '__user' annotation to the data member of struct tagSCmdRequest which is much cleaner approach as suggested by [email protected]
v1:
- added 'void __user *' casts to supress the warnings

 drivers/staging/vt6655/iocmd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6655/iocmd.h +0 -0
index e499f1b..dd12498 100644

drivers/staging/vt6655/iocmd.h typedef enum tagWZONETYPE { · line 106

Quoted 8 lines
drivers/staging/vt6655/iocmd.h +1 -1
@@ -100,7 +100,7 @@ typedef enum tagWZONETYPE {
 #pragma pack(1)
 typedef struct tagSCmdRequest {
 	u8	    name[16];
-	void	*data;
+	void __user *data;
 	u16	    wResult;
 	u16     wCmdCode;
 } SCmdRequest, *PSCmdRequest;

This patch doesn't apply against my tree at all, what did you make it against?

Always work against linux-next, or the staging-next branch of my staging.git tree on git.kernel.org.

thanks,

greg k-h

#3 lore raw
Quoted 10 lines · Greg KH

This patch doesn't apply against my tree at all, what did you make it against?

Always work against linux-next, or the staging-next branch of my staging.git tree on git.kernel.org.

thanks,

greg k-h

Hi,

I am working on staging.git. After rebasing with staging-next, git log shows someone has recently submitted this fix.

Thanks,
Anil