All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sh: fix sparse annotation in SH's __get_user_check()
@ 2021-01-23 17:32 Luc Van Oostenryck
  2021-01-25  9:51 ` Oliver Hartkopp
  0 siblings, 1 reply; 2+ messages in thread
From: Luc Van Oostenryck @ 2021-01-23 17:32 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker
  Cc: linux-sh, linux-kernel, Luc Van Oostenryck, kernel test robot,
	Oliver Hartkopp

The pointer in get_user() and friends is supposed to be a __user pointer.
But in SH's implementation of __get_user_check(), the pointer is
assigned to a local variable __gu_addr which is lacking the __user
annotation. As consequence, a warning is issued for every of its uses.

So, add the missing __user annotation (this remove ~700 warnings when
using defconfig).

Link: https://lore.kernel.org/r/202101141753.ropIZ9nh-lkp@intel.com
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 arch/sh/include/asm/uaccess.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sh/include/asm/uaccess.h b/arch/sh/include/asm/uaccess.h
index 73f3b48d4a34..e2623fe2ac09 100644
--- a/arch/sh/include/asm/uaccess.h
+++ b/arch/sh/include/asm/uaccess.h
@@ -68,7 +68,7 @@ struct __large_struct { unsigned long buf[100]; };
 ({									\
 	long __gu_err = -EFAULT;					\
 	unsigned long __gu_val = 0;					\
-	const __typeof__(*(ptr)) *__gu_addr = (ptr);			\
+	const __typeof__(*(ptr)) __user *__gu_addr = (ptr);		\
 	if (likely(access_ok(__gu_addr, (size))))		\
 		__get_user_size(__gu_val, __gu_addr, (size), __gu_err);	\
 	(x) = (__force __typeof__(*(ptr)))__gu_val;			\

base-commit: 5c8fe583cce542aa0b84adc939ce85293de36e5e
-- 
2.30.0


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

* Re: [PATCH] sh: fix sparse annotation in SH's __get_user_check()
  2021-01-23 17:32 [PATCH] sh: fix sparse annotation in SH's __get_user_check() Luc Van Oostenryck
@ 2021-01-25  9:51 ` Oliver Hartkopp
  0 siblings, 0 replies; 2+ messages in thread
From: Oliver Hartkopp @ 2021-01-25  9:51 UTC (permalink / raw)
  To: Luc Van Oostenryck, Yoshinori Sato, Rich Felker
  Cc: linux-sh, linux-kernel, kernel test robot

On 23.01.21 18:32, Luc Van Oostenryck wrote:
> The pointer in get_user() and friends is supposed to be a __user pointer.
> But in SH's implementation of __get_user_check(), the pointer is
> assigned to a local variable __gu_addr which is lacking the __user
> annotation. As consequence, a warning is issued for every of its uses.
> 
> So, add the missing __user annotation (this remove ~700 warnings when
> using defconfig).

Many thanks that you were able to spot this issue, Luc!

Best regards,
Oliver

> 
> Link: https://lore.kernel.org/r/202101141753.ropIZ9nh-lkp@intel.com
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Oliver Hartkopp <socketcan@hartkopp.net>
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> ---
>   arch/sh/include/asm/uaccess.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/sh/include/asm/uaccess.h b/arch/sh/include/asm/uaccess.h
> index 73f3b48d4a34..e2623fe2ac09 100644
> --- a/arch/sh/include/asm/uaccess.h
> +++ b/arch/sh/include/asm/uaccess.h
> @@ -68,7 +68,7 @@ struct __large_struct { unsigned long buf[100]; };
>   ({									\
>   	long __gu_err = -EFAULT;					\
>   	unsigned long __gu_val = 0;					\
> -	const __typeof__(*(ptr)) *__gu_addr = (ptr);			\
> +	const __typeof__(*(ptr)) __user *__gu_addr = (ptr);		\
>   	if (likely(access_ok(__gu_addr, (size))))		\
>   		__get_user_size(__gu_val, __gu_addr, (size), __gu_err);	\
>   	(x) = (__force __typeof__(*(ptr)))__gu_val;			\
> 
> base-commit: 5c8fe583cce542aa0b84adc939ce85293de36e5e
> 

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

end of thread, other threads:[~2021-01-25 10:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-23 17:32 [PATCH] sh: fix sparse annotation in SH's __get_user_check() Luc Van Oostenryck
2021-01-25  9:51 ` Oliver Hartkopp

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.