public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix riscv sparse warnings
@ 2025-09-03 18:53 Alexandre Ghiti
  2025-09-03 18:53 ` [PATCH 1/2] riscv: Fix sparse warning in __get_user_error() Alexandre Ghiti
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Alexandre Ghiti @ 2025-09-03 18:53 UTC (permalink / raw)
  To: kernel test robot, Al Viro, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, Cyril Bur, Jisheng Zhang
  Cc: linux-riscv, linux-kernel, Alexandre Ghiti, stable

This series simply fixes 2 recently introduced sparse warnings.

Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
---
Alexandre Ghiti (2):
      riscv: Fix sparse warning in __get_user_error()
      riscv: Fix sparse warning about different address spaces

 arch/riscv/include/asm/uaccess.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
base-commit: ae9a687664d965b13eeab276111b2f97dd02e090
change-id: 20250903-dev-alex-sparse_warnings_v1-ecb4a333afdd

Best regards,
-- 
Alexandre Ghiti <alexghiti@rivosinc.com>


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

* [PATCH 1/2] riscv: Fix sparse warning in __get_user_error()
  2025-09-03 18:53 [PATCH 0/2] Fix riscv sparse warnings Alexandre Ghiti
@ 2025-09-03 18:53 ` Alexandre Ghiti
  2025-09-04  0:34   ` Cyril Bur
                     ` (3 more replies)
  2025-09-03 18:53 ` [PATCH 2/2] riscv: Fix sparse warning about different address spaces Alexandre Ghiti
  2025-09-17  2:40 ` [PATCH 0/2] Fix riscv sparse warnings patchwork-bot+linux-riscv
  2 siblings, 4 replies; 12+ messages in thread
From: Alexandre Ghiti @ 2025-09-03 18:53 UTC (permalink / raw)
  To: kernel test robot, Al Viro, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, Cyril Bur, Jisheng Zhang
  Cc: linux-riscv, linux-kernel, Alexandre Ghiti, stable

We used to assign 0 to x without an appropriate cast which results in
sparse complaining when x is a pointer:

>> block/ioctl.c:72:39: sparse: sparse: Using plain integer as NULL pointer

So fix this by casting 0 to the correct type of x.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202508062321.gHv4kvuY-lkp@intel.com/
Fixes: f6bff7827a48 ("riscv: uaccess: use 'asm_goto_output' for get_user()")
Cc: stable@vger.kernel.org
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
---
 arch/riscv/include/asm/uaccess.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h
index 22e3f52a763d1c0350e8185225e4c99aac3fc549..551e7490737effb2c238e6a4db50293ece7c9df9 100644
--- a/arch/riscv/include/asm/uaccess.h
+++ b/arch/riscv/include/asm/uaccess.h
@@ -209,7 +209,7 @@ do {									\
 		err = 0;						\
 		break;							\
 __gu_failed:								\
-		x = 0;							\
+		x = (__typeof__(x))0;					\
 		err = -EFAULT;						\
 } while (0)
 

-- 
2.34.1


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

* [PATCH 2/2] riscv: Fix sparse warning about different address spaces
  2025-09-03 18:53 [PATCH 0/2] Fix riscv sparse warnings Alexandre Ghiti
  2025-09-03 18:53 ` [PATCH 1/2] riscv: Fix sparse warning in __get_user_error() Alexandre Ghiti
@ 2025-09-03 18:53 ` Alexandre Ghiti
  2025-09-04  0:42   ` Cyril Bur
                     ` (3 more replies)
  2025-09-17  2:40 ` [PATCH 0/2] Fix riscv sparse warnings patchwork-bot+linux-riscv
  2 siblings, 4 replies; 12+ messages in thread
From: Alexandre Ghiti @ 2025-09-03 18:53 UTC (permalink / raw)
  To: kernel test robot, Al Viro, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, Cyril Bur, Jisheng Zhang
  Cc: linux-riscv, linux-kernel, Alexandre Ghiti, stable

We did not propagate the __user attribute of the pointers in
__get_kernel_nofault() and __put_kernel_nofault(), which results in
sparse complaining:

>> mm/maccess.c:41:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got unsigned long long [usertype] * @@
   mm/maccess.c:41:17: sparse:     expected void const [noderef] __user *from
   mm/maccess.c:41:17: sparse:     got unsigned long long [usertype] *

So fix this by correctly casting those pointers.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202508161713.RWu30Lv1-lkp@intel.com/
Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
Fixes: f6bff7827a48 ("riscv: uaccess: use 'asm_goto_output' for get_user()")
Cc: stable@vger.kernel.org
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
---
 arch/riscv/include/asm/uaccess.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h
index 551e7490737effb2c238e6a4db50293ece7c9df9..f5f4f7f85543f2a635b18e4bd1c6202b20e3b239 100644
--- a/arch/riscv/include/asm/uaccess.h
+++ b/arch/riscv/include/asm/uaccess.h
@@ -438,10 +438,10 @@ unsigned long __must_check clear_user(void __user *to, unsigned long n)
 }
 
 #define __get_kernel_nofault(dst, src, type, err_label)			\
-	__get_user_nocheck(*((type *)(dst)), (type *)(src), err_label)
+	__get_user_nocheck(*((type *)(dst)), (__force __user type *)(src), err_label)
 
 #define __put_kernel_nofault(dst, src, type, err_label)			\
-	__put_user_nocheck(*((type *)(src)), (type *)(dst), err_label)
+	__put_user_nocheck(*((type *)(src)), (__force __user type *)(dst), err_label)
 
 static __must_check __always_inline bool user_access_begin(const void __user *ptr, size_t len)
 {

-- 
2.34.1


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

* Re: [PATCH 1/2] riscv: Fix sparse warning in __get_user_error()
  2025-09-03 18:53 ` [PATCH 1/2] riscv: Fix sparse warning in __get_user_error() Alexandre Ghiti
@ 2025-09-04  0:34   ` Cyril Bur
  2025-09-04 13:50   ` Clément Léger
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Cyril Bur @ 2025-09-04  0:34 UTC (permalink / raw)
  To: Alexandre Ghiti, kernel test robot, Al Viro, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Jisheng Zhang
  Cc: linux-riscv, linux-kernel, stable

These two are on me. Sorry.

Thanks for fixing them Alexandre.

On 4/9/2025 4:53 am, Alexandre Ghiti wrote:
> We used to assign 0 to x without an appropriate cast which results in
> sparse complaining when x is a pointer:
> 
>>> block/ioctl.c:72:39: sparse: sparse: Using plain integer as NULL pointer
> 
> So fix this by casting 0 to the correct type of x.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202508062321.gHv4kvuY-lkp@intel.com/
> Fixes: f6bff7827a48 ("riscv: uaccess: use 'asm_goto_output' for get_user()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>

Reviewed-by: Cyril Bur <cyrilbur@tenstorrent.com>

> ---
>   arch/riscv/include/asm/uaccess.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h
> index 22e3f52a763d1c0350e8185225e4c99aac3fc549..551e7490737effb2c238e6a4db50293ece7c9df9 100644
> --- a/arch/riscv/include/asm/uaccess.h
> +++ b/arch/riscv/include/asm/uaccess.h
> @@ -209,7 +209,7 @@ do {									\
>   		err = 0;						\
>   		break;							\
>   __gu_failed:								\
> -		x = 0;							\
> +		x = (__typeof__(x))0;					\
>   		err = -EFAULT;						\
>   } while (0)
>   
> 


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

* Re: [PATCH 2/2] riscv: Fix sparse warning about different address spaces
  2025-09-03 18:53 ` [PATCH 2/2] riscv: Fix sparse warning about different address spaces Alexandre Ghiti
@ 2025-09-04  0:42   ` Cyril Bur
  2025-09-05  6:29   ` Clément Léger
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Cyril Bur @ 2025-09-04  0:42 UTC (permalink / raw)
  To: Alexandre Ghiti, kernel test robot, Al Viro, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Jisheng Zhang
  Cc: linux-riscv, linux-kernel, stable



On 4/9/2025 4:53 am, Alexandre Ghiti wrote:
> We did not propagate the __user attribute of the pointers in
> __get_kernel_nofault() and __put_kernel_nofault(), which results in
> sparse complaining:
> 
>>> mm/maccess.c:41:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got unsigned long long [usertype] * @@
>     mm/maccess.c:41:17: sparse:     expected void const [noderef] __user *from
>     mm/maccess.c:41:17: sparse:     got unsigned long long [usertype] *
> 
> So fix this by correctly casting those pointers.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202508161713.RWu30Lv1-lkp@intel.com/
> Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
> Fixes: f6bff7827a48 ("riscv: uaccess: use 'asm_goto_output' for get_user()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>

Reviewed-by: Cyril Bur <cyrilbur@tenstorrent.com>

> ---
>   arch/riscv/include/asm/uaccess.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h
> index 551e7490737effb2c238e6a4db50293ece7c9df9..f5f4f7f85543f2a635b18e4bd1c6202b20e3b239 100644
> --- a/arch/riscv/include/asm/uaccess.h
> +++ b/arch/riscv/include/asm/uaccess.h
> @@ -438,10 +438,10 @@ unsigned long __must_check clear_user(void __user *to, unsigned long n)
>   }
>   
>   #define __get_kernel_nofault(dst, src, type, err_label)			\
> -	__get_user_nocheck(*((type *)(dst)), (type *)(src), err_label)
> +	__get_user_nocheck(*((type *)(dst)), (__force __user type *)(src), err_label)
>   
>   #define __put_kernel_nofault(dst, src, type, err_label)			\
> -	__put_user_nocheck(*((type *)(src)), (type *)(dst), err_label)
> +	__put_user_nocheck(*((type *)(src)), (__force __user type *)(dst), err_label)
>   
>   static __must_check __always_inline bool user_access_begin(const void __user *ptr, size_t len)
>   {
> 


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

* Re: [PATCH 1/2] riscv: Fix sparse warning in __get_user_error()
  2025-09-03 18:53 ` [PATCH 1/2] riscv: Fix sparse warning in __get_user_error() Alexandre Ghiti
  2025-09-04  0:34   ` Cyril Bur
@ 2025-09-04 13:50   ` Clément Léger
  2025-09-05 22:14   ` Paul Walmsley
  2025-09-20  0:55   ` Paul Walmsley
  3 siblings, 0 replies; 12+ messages in thread
From: Clément Léger @ 2025-09-04 13:50 UTC (permalink / raw)
  To: Alexandre Ghiti, kernel test robot, Al Viro, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Cyril Bur,
	Jisheng Zhang
  Cc: linux-riscv, linux-kernel, stable



On 03/09/2025 20:53, Alexandre Ghiti wrote:
> We used to assign 0 to x without an appropriate cast which results in
> sparse complaining when x is a pointer:
> 
>>> block/ioctl.c:72:39: sparse: sparse: Using plain integer as NULL pointer
> 
> So fix this by casting 0 to the correct type of x.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202508062321.gHv4kvuY-lkp@intel.com/
> Fixes: f6bff7827a48 ("riscv: uaccess: use 'asm_goto_output' for get_user()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
> ---
>  arch/riscv/include/asm/uaccess.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h
> index 22e3f52a763d1c0350e8185225e4c99aac3fc549..551e7490737effb2c238e6a4db50293ece7c9df9 100644
> --- a/arch/riscv/include/asm/uaccess.h
> +++ b/arch/riscv/include/asm/uaccess.h
> @@ -209,7 +209,7 @@ do {									\
>  		err = 0;						\
>  		break;							\
>  __gu_failed:								\
> -		x = 0;							\
> +		x = (__typeof__(x))0;					\
>  		err = -EFAULT;						\
>  } while (0)
>  
> 

Hi Alex,

I applied that and checked that the sparse warnings were fixed as well,
looks good to me.

Reviewed-by: Clément Léger <cleger@rivosinc.com>

Thanks,

Clément

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

* Re: [PATCH 2/2] riscv: Fix sparse warning about different address spaces
  2025-09-03 18:53 ` [PATCH 2/2] riscv: Fix sparse warning about different address spaces Alexandre Ghiti
  2025-09-04  0:42   ` Cyril Bur
@ 2025-09-05  6:29   ` Clément Léger
  2025-09-05 22:15   ` Paul Walmsley
  2025-09-20  0:55   ` Paul Walmsley
  3 siblings, 0 replies; 12+ messages in thread
From: Clément Léger @ 2025-09-05  6:29 UTC (permalink / raw)
  To: Alexandre Ghiti, kernel test robot, Al Viro, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Cyril Bur,
	Jisheng Zhang
  Cc: linux-riscv, linux-kernel, stable



On 03/09/2025 20:53, Alexandre Ghiti wrote:
> We did not propagate the __user attribute of the pointers in
> __get_kernel_nofault() and __put_kernel_nofault(), which results in
> sparse complaining:
> 
>>> mm/maccess.c:41:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got unsigned long long [usertype] * @@
>    mm/maccess.c:41:17: sparse:     expected void const [noderef] __user *from
>    mm/maccess.c:41:17: sparse:     got unsigned long long [usertype] *
> 
> So fix this by correctly casting those pointers.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202508161713.RWu30Lv1-lkp@intel.com/
> Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
> Fixes: f6bff7827a48 ("riscv: uaccess: use 'asm_goto_output' for get_user()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
> ---
>  arch/riscv/include/asm/uaccess.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h
> index 551e7490737effb2c238e6a4db50293ece7c9df9..f5f4f7f85543f2a635b18e4bd1c6202b20e3b239 100644
> --- a/arch/riscv/include/asm/uaccess.h
> +++ b/arch/riscv/include/asm/uaccess.h
> @@ -438,10 +438,10 @@ unsigned long __must_check clear_user(void __user *to, unsigned long n)
>  }
>  
>  #define __get_kernel_nofault(dst, src, type, err_label)			\
> -	__get_user_nocheck(*((type *)(dst)), (type *)(src), err_label)
> +	__get_user_nocheck(*((type *)(dst)), (__force __user type *)(src), err_label)
>  
>  #define __put_kernel_nofault(dst, src, type, err_label)			\
> -	__put_user_nocheck(*((type *)(src)), (type *)(dst), err_label)
> +	__put_user_nocheck(*((type *)(src)), (__force __user type *)(dst), err_label)
>  
>  static __must_check __always_inline bool user_access_begin(const void __user *ptr, size_t len)
>  {
> 

Hi Alex,

LGTM,

Reviewed-by: Clément Léger <cleger@rivosinc.com>

Thanks,

Clément


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

* Re: [PATCH 1/2] riscv: Fix sparse warning in __get_user_error()
  2025-09-03 18:53 ` [PATCH 1/2] riscv: Fix sparse warning in __get_user_error() Alexandre Ghiti
  2025-09-04  0:34   ` Cyril Bur
  2025-09-04 13:50   ` Clément Léger
@ 2025-09-05 22:14   ` Paul Walmsley
  2025-09-20  0:55   ` Paul Walmsley
  3 siblings, 0 replies; 12+ messages in thread
From: Paul Walmsley @ 2025-09-05 22:14 UTC (permalink / raw)
  To: Alexandre Ghiti
  Cc: kernel test robot, Al Viro, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, Cyril Bur, Jisheng Zhang, linux-riscv,
	linux-kernel, stable

On Wed, 3 Sep 2025, Alexandre Ghiti wrote:

> We used to assign 0 to x without an appropriate cast which results in
> sparse complaining when x is a pointer:
> 
> >> block/ioctl.c:72:39: sparse: sparse: Using plain integer as NULL pointer
> 
> So fix this by casting 0 to the correct type of x.

Thanks, queued for v6.17-rc fixes.

- Paul

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

* Re: [PATCH 2/2] riscv: Fix sparse warning about different address spaces
  2025-09-03 18:53 ` [PATCH 2/2] riscv: Fix sparse warning about different address spaces Alexandre Ghiti
  2025-09-04  0:42   ` Cyril Bur
  2025-09-05  6:29   ` Clément Léger
@ 2025-09-05 22:15   ` Paul Walmsley
  2025-09-20  0:55   ` Paul Walmsley
  3 siblings, 0 replies; 12+ messages in thread
From: Paul Walmsley @ 2025-09-05 22:15 UTC (permalink / raw)
  To: Alexandre Ghiti
  Cc: kernel test robot, Al Viro, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, Cyril Bur, Jisheng Zhang, linux-riscv,
	linux-kernel, stable

On Wed, 3 Sep 2025, Alexandre Ghiti wrote:

> We did not propagate the __user attribute of the pointers in
> __get_kernel_nofault() and __put_kernel_nofault(), which results in
> sparse complaining:
> 
> >> mm/maccess.c:41:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got unsigned long long [usertype] * @@
>    mm/maccess.c:41:17: sparse:     expected void const [noderef] __user *from
>    mm/maccess.c:41:17: sparse:     got unsigned long long [usertype] *
> 
> So fix this by correctly casting those pointers.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202508161713.RWu30Lv1-lkp@intel.com/
> Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
> Fixes: f6bff7827a48 ("riscv: uaccess: use 'asm_goto_output' for get_user()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>

Thanks, queued for v6.17-rc fixes.

- Paul

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

* Re: [PATCH 0/2] Fix riscv sparse warnings
  2025-09-03 18:53 [PATCH 0/2] Fix riscv sparse warnings Alexandre Ghiti
  2025-09-03 18:53 ` [PATCH 1/2] riscv: Fix sparse warning in __get_user_error() Alexandre Ghiti
  2025-09-03 18:53 ` [PATCH 2/2] riscv: Fix sparse warning about different address spaces Alexandre Ghiti
@ 2025-09-17  2:40 ` patchwork-bot+linux-riscv
  2 siblings, 0 replies; 12+ messages in thread
From: patchwork-bot+linux-riscv @ 2025-09-17  2:40 UTC (permalink / raw)
  To: Alexandre Ghiti
  Cc: linux-riscv, lkp, viro, paul.walmsley, palmer, aou, alex,
	cyrilbur, jszhang, linux-kernel, stable

Hello:

This series was applied to riscv/linux.git (for-next)
by Paul Walmsley <pjw@kernel.org>:

On Wed, 03 Sep 2025 18:53:07 +0000 you wrote:
> This series simply fixes 2 recently introduced sparse warnings.
> 
> Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
> ---
> Alexandre Ghiti (2):
>       riscv: Fix sparse warning in __get_user_error()
>       riscv: Fix sparse warning about different address spaces
> 
> [...]

Here is the summary with links:
  - [1/2] riscv: Fix sparse warning in __get_user_error()
    https://git.kernel.org/riscv/c/fef7ded169ed
  - [2/2] riscv: Fix sparse warning about different address spaces
    https://git.kernel.org/riscv/c/a03ee11b8f85

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH 1/2] riscv: Fix sparse warning in __get_user_error()
  2025-09-03 18:53 ` [PATCH 1/2] riscv: Fix sparse warning in __get_user_error() Alexandre Ghiti
                     ` (2 preceding siblings ...)
  2025-09-05 22:14   ` Paul Walmsley
@ 2025-09-20  0:55   ` Paul Walmsley
  3 siblings, 0 replies; 12+ messages in thread
From: Paul Walmsley @ 2025-09-20  0:55 UTC (permalink / raw)
  To: Alexandre Ghiti
  Cc: kernel test robot, Al Viro, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, Cyril Bur, Jisheng Zhang, linux-riscv,
	linux-kernel, stable

On Wed, 3 Sep 2025, Alexandre Ghiti wrote:

> We used to assign 0 to x without an appropriate cast which results in
> sparse complaining when x is a pointer:
> 
> >> block/ioctl.c:72:39: sparse: sparse: Using plain integer as NULL pointer
> 
> So fix this by casting 0 to the correct type of x.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202508062321.gHv4kvuY-lkp@intel.com/
> Fixes: f6bff7827a48 ("riscv: uaccess: use 'asm_goto_output' for get_user()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
> ---
>  arch/riscv/include/asm/uaccess.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks, this one was sent upstream as part of the last fixes PR.

- Paul

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

* Re: [PATCH 2/2] riscv: Fix sparse warning about different address spaces
  2025-09-03 18:53 ` [PATCH 2/2] riscv: Fix sparse warning about different address spaces Alexandre Ghiti
                     ` (2 preceding siblings ...)
  2025-09-05 22:15   ` Paul Walmsley
@ 2025-09-20  0:55   ` Paul Walmsley
  3 siblings, 0 replies; 12+ messages in thread
From: Paul Walmsley @ 2025-09-20  0:55 UTC (permalink / raw)
  To: Alexandre Ghiti
  Cc: kernel test robot, Al Viro, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, Cyril Bur, Jisheng Zhang, linux-riscv,
	linux-kernel, stable

On Wed, 3 Sep 2025, Alexandre Ghiti wrote:

> We did not propagate the __user attribute of the pointers in
> __get_kernel_nofault() and __put_kernel_nofault(), which results in
> sparse complaining:
> 
> >> mm/maccess.c:41:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got unsigned long long [usertype] * @@
>    mm/maccess.c:41:17: sparse:     expected void const [noderef] __user *from
>    mm/maccess.c:41:17: sparse:     got unsigned long long [usertype] *
> 
> So fix this by correctly casting those pointers.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202508161713.RWu30Lv1-lkp@intel.com/
> Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
> Fixes: f6bff7827a48 ("riscv: uaccess: use 'asm_goto_output' for get_user()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>

Thanks, this one was sent upstream as part of the last fixes PR.
  

- Paul
  


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

end of thread, other threads:[~2025-09-20  0:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-03 18:53 [PATCH 0/2] Fix riscv sparse warnings Alexandre Ghiti
2025-09-03 18:53 ` [PATCH 1/2] riscv: Fix sparse warning in __get_user_error() Alexandre Ghiti
2025-09-04  0:34   ` Cyril Bur
2025-09-04 13:50   ` Clément Léger
2025-09-05 22:14   ` Paul Walmsley
2025-09-20  0:55   ` Paul Walmsley
2025-09-03 18:53 ` [PATCH 2/2] riscv: Fix sparse warning about different address spaces Alexandre Ghiti
2025-09-04  0:42   ` Cyril Bur
2025-09-05  6:29   ` Clément Léger
2025-09-05 22:15   ` Paul Walmsley
2025-09-20  0:55   ` Paul Walmsley
2025-09-17  2:40 ` [PATCH 0/2] Fix riscv sparse warnings patchwork-bot+linux-riscv

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