Re: [PATCH 2/2] riscv: Fix sparse warning about different address spaces
From: Paul Walmsley
Date: Fri Sep 19 2025 - 20:56:01 EST
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@xxxxxxxxx>
> Closes: https://lore.kernel.org/oe-kbuild-all/202508161713.RWu30Lv1-lkp@xxxxxxxxx/
> Suggested-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> Fixes: f6bff7827a48 ("riscv: uaccess: use 'asm_goto_output' for get_user()")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Alexandre Ghiti <alexghiti@xxxxxxxxxxxx>
Thanks, this one was sent upstream as part of the last fixes PR.
- Paul