public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] staging: vt6655: ioctl.c - missing __user annotation
@ 2014-07-30 12:59 Anil Belur
  2014-07-30 13:26 ` Dan Carpenter
  2014-07-31  0:08 ` Greg KH
  0 siblings, 2 replies; 4+ messages in thread
From: Anil Belur @ 2014-07-30 12:59 UTC (permalink / raw)
  To: tklauser, dan.carpenter, bjorn, silvio.fricke, gregkh
  Cc: devel, linux-kernel, 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

Signed-off-by: Anil Belur <askb23@gmail.com>
---
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 tklauser@distanz.ch
v1:
- added 'void __user *' casts to supress the warnings

 drivers/staging/vt6655/iocmd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/vt6655/iocmd.h b/drivers/staging/vt6655/iocmd.h
index e499f1b..dd12498 100644
--- a/drivers/staging/vt6655/iocmd.h
+++ b/drivers/staging/vt6655/iocmd.h
@@ -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;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] staging: vt6655: ioctl.c - missing __user annotation
  2014-07-30 12:59 [PATCH v3] staging: vt6655: ioctl.c - missing __user annotation Anil Belur
@ 2014-07-30 13:26 ` Dan Carpenter
  2014-07-31  0:08 ` Greg KH
  1 sibling, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2014-07-30 13:26 UTC (permalink / raw)
  To: Anil Belur; +Cc: tklauser, bjorn, silvio.fricke, gregkh, devel, linux-kernel

On Wed, Jul 30, 2014 at 06:29:57PM +0530, Anil Belur wrote:
> - 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
> 
> Signed-off-by: Anil Belur <askb23@gmail.com>

Looks very nice now.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] staging: vt6655: ioctl.c - missing __user annotation
  2014-07-30 12:59 [PATCH v3] staging: vt6655: ioctl.c - missing __user annotation Anil Belur
  2014-07-30 13:26 ` Dan Carpenter
@ 2014-07-31  0:08 ` Greg KH
  2014-07-31  3:16   ` Anil Shashikumar Belur
  1 sibling, 1 reply; 4+ messages in thread
From: Greg KH @ 2014-07-31  0:08 UTC (permalink / raw)
  To: Anil Belur
  Cc: tklauser, dan.carpenter, bjorn, silvio.fricke, devel,
	linux-kernel

On Wed, Jul 30, 2014 at 06:29:57PM +0530, Anil Belur wrote:
> - 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
> 
> Signed-off-by: Anil Belur <askb23@gmail.com>
> ---
> 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 tklauser@distanz.ch
> v1:
> - added 'void __user *' casts to supress the warnings
> 
>  drivers/staging/vt6655/iocmd.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/vt6655/iocmd.h b/drivers/staging/vt6655/iocmd.h
> index e499f1b..dd12498 100644
> --- a/drivers/staging/vt6655/iocmd.h
> +++ b/drivers/staging/vt6655/iocmd.h
> @@ -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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] staging: vt6655: ioctl.c - missing __user annotation
  2014-07-31  0:08 ` Greg KH
@ 2014-07-31  3:16   ` Anil Shashikumar Belur
  0 siblings, 0 replies; 4+ messages in thread
From: Anil Shashikumar Belur @ 2014-07-31  3:16 UTC (permalink / raw)
  To: Greg KH; +Cc: tklauser, dan.carpenter, bjorn, silvio.fricke, devel,
	linux-kernel


On Thursday 31 July 2014 05:38 AM, Greg KH wrote:
>
> 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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-07-31  3:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-30 12:59 [PATCH v3] staging: vt6655: ioctl.c - missing __user annotation Anil Belur
2014-07-30 13:26 ` Dan Carpenter
2014-07-31  0:08 ` Greg KH
2014-07-31  3:16   ` Anil Shashikumar Belur

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox