diff mbox series

misc: xilinx_sdfec: add missing __user annotation

Message ID 20191121120827.4079-1-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined
Commit a6b07e89fd8530b943217ccd4909d1bf65acc45d
Headers show
Series misc: xilinx_sdfec: add missing __user annotation | expand

Commit Message

Luc Van Oostenryck Nov. 21, 2019, 12:08 p.m. UTC
The second arg of xsdfec_set_order() is a 'void __user *'
and this pointer is then used in get_user() which expect
a __user pointer.

But get_user() can't be used with a void pointer, it a
pointer to the effective type. This is done here by casting
the argument to a pointer to the effective type but the
__user is missing in the cast.

Fix this by adding the missing __user in the cast.

CC: Derek Kiernan <derek.kiernan@xilinx.com>
CC: Dragan Cvetic <dragan.cvetic@xilinx.com>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 drivers/misc/xilinx_sdfec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dragan Cvetic Nov. 21, 2019, 3:40 p.m. UTC | #1
Hi Luc,

Find my comments below

> -----Original Message-----
> From: Luc Van Oostenryck [mailto:luc.vanoostenryck@gmail.com]
> Sent: Thursday 21 November 2019 12:08
> To: linux-kernel@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org; Luc Van Oostenryck <luc.vanoostenryck@gmail.com>; Derek Kiernan
> <dkiernan@xilinx.com>; Dragan Cvetic <draganc@xilinx.com>
> Subject: [PATCH] misc: xilinx_sdfec: add missing __user annotation
> 
> The second arg of xsdfec_set_order() is a 'void __user *'
> and this pointer is then used in get_user() which expect
> a __user pointer.
> 
> But get_user() can't be used with a void pointer, it a
> pointer to the effective type. This is done here by casting
> the argument to a pointer to the effective type but the
> __user is missing in the cast.
> 
> Fix this by adding the missing __user in the cast.
> 
> CC: Derek Kiernan <derek.kiernan@xilinx.com>
> CC: Dragan Cvetic <dragan.cvetic@xilinx.com>
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> ---
>  drivers/misc/xilinx_sdfec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/misc/xilinx_sdfec.c b/drivers/misc/xilinx_sdfec.c
> index 11835969e982..f05e1b4c2826 100644
> --- a/drivers/misc/xilinx_sdfec.c
> +++ b/drivers/misc/xilinx_sdfec.c
> @@ -733,7 +733,7 @@ static int xsdfec_set_order(struct xsdfec_dev *xsdfec, void __user *arg)
>  	enum xsdfec_order order;
>  	int err;
> 
> -	err = get_user(order, (enum xsdfec_order *)arg);
> +	err = get_user(order, (enum xsdfec_order __user *)arg);
>  	if (err)
>  		return -EFAULT;
> 
> --
> 2.24.0


Acked-by: Dragan Cvetic <dragan.cvetic@xilinx.com>
diff mbox series

Patch

diff --git a/drivers/misc/xilinx_sdfec.c b/drivers/misc/xilinx_sdfec.c
index 11835969e982..f05e1b4c2826 100644
--- a/drivers/misc/xilinx_sdfec.c
+++ b/drivers/misc/xilinx_sdfec.c
@@ -733,7 +733,7 @@  static int xsdfec_set_order(struct xsdfec_dev *xsdfec, void __user *arg)
 	enum xsdfec_order order;
 	int err;
 
-	err = get_user(order, (enum xsdfec_order *)arg);
+	err = get_user(order, (enum xsdfec_order __user *)arg);
 	if (err)
 		return -EFAULT;