mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] RISC-V: uaccess: Wrap the get_user_8 uaccess macro
@ 2025-06-10 21:30 Palmer Dabbelt
  2025-06-11  7:31 ` Alexandre Ghiti
  2025-06-12 20:10 ` patchwork-bot+linux-riscv
  0 siblings, 2 replies; 4+ messages in thread
From: Palmer Dabbelt @ 2025-06-10 21:30 UTC (permalink / raw)
  To: linux-riscv
  Cc: Paul Walmsley, Palmer Dabbelt, aou, Alexandre Ghiti, cyrilbur,
	jszhang, cleger, samuel.holland, linux-riscv, linux-kernel

From: Palmer Dabbelt <palmer@dabbelt.com>

I must have lost this rebasing things during the merge window, I know I
got it at some point but it's not here now.  Without this I get warnings
along the lines of

    include/linux/fs.h:3975:15: warning: label followed by a declaration is a C23 extension [-Wc23-extensions]
     3975 |         if (unlikely(get_user(c, path)))
          |                      ^
    arch/riscv/include/asm/uaccess.h:274:3: note: expanded from macro 'get_user'
      274 |                 __get_user((x), __p) :                          \
          |                 ^
    arch/riscv/include/asm/uaccess.h:244:2: note: expanded from macro '__get_user'
      244 |         __get_user_error(__gu_val, __gu_ptr, __gu_err);         \
          |         ^
    arch/riscv/include/asm/uaccess.h:207:2: note: expanded from macro '__get_user_error'
      207 |         __ge  LD [M]  net/802/psnap.ko
    t_user_nocheck(x, ptr, __gu_failed);                        \
          |         ^
    arch/riscv/include/asm/uaccess.h:196:3: note: expanded from macro '__get_user_nocheck'
      196 |                 __get_user_8((x), __gu_ptr, label);             \
          |                 ^
    arch/riscv/include/asm/uaccess.h:130:2: note: expanded from macro '__get_user_8'
      130 |         u32 __user *__ptr = (u32 __user *)(ptr);                \
          |         ^

Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
---
 arch/riscv/include/asm/uaccess.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h
index d472da4450e6..525e50db24f7 100644
--- a/arch/riscv/include/asm/uaccess.h
+++ b/arch/riscv/include/asm/uaccess.h
@@ -127,6 +127,7 @@ do {								\
 
 #ifdef CONFIG_CC_HAS_ASM_GOTO_OUTPUT
 #define __get_user_8(x, ptr, label)				\
+do {								\
 	u32 __user *__ptr = (u32 __user *)(ptr);		\
 	u32 __lo, __hi;						\
 	asm_goto_output(					\
@@ -141,7 +142,7 @@ do {								\
 		: : label);                                     \
 	(x) = (__typeof__(x))((__typeof__((x) - (x)))(		\
 		(((u64)__hi << 32) | __lo)));			\
-
+} while (0)
 #else /* !CONFIG_CC_HAS_ASM_GOTO_OUTPUT */
 #define __get_user_8(x, ptr, label)				\
 do {								\
-- 
2.39.5 (Apple Git-154)


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

* Re: [PATCH] RISC-V: uaccess: Wrap the get_user_8 uaccess macro
  2025-06-10 21:30 [PATCH] RISC-V: uaccess: Wrap the get_user_8 uaccess macro Palmer Dabbelt
@ 2025-06-11  7:31 ` Alexandre Ghiti
  2025-06-12 19:42   ` Palmer Dabbelt
  2025-06-12 20:10 ` patchwork-bot+linux-riscv
  1 sibling, 1 reply; 4+ messages in thread
From: Alexandre Ghiti @ 2025-06-11  7:31 UTC (permalink / raw)
  To: Palmer Dabbelt, linux-riscv
  Cc: Paul Walmsley, aou, cyrilbur, jszhang, cleger, samuel.holland,
	linux-kernel

On 6/10/25 23:30, Palmer Dabbelt wrote:
> From: Palmer Dabbelt <palmer@dabbelt.com>
>
> I must have lost this rebasing things during the merge window, I know I
> got it at some point but it's not here now.  Without this I get warnings
> along the lines of
>
>      include/linux/fs.h:3975:15: warning: label followed by a declaration is a C23 extension [-Wc23-extensions]
>       3975 |         if (unlikely(get_user(c, path)))
>            |                      ^
>      arch/riscv/include/asm/uaccess.h:274:3: note: expanded from macro 'get_user'
>        274 |                 __get_user((x), __p) :                          \
>            |                 ^
>      arch/riscv/include/asm/uaccess.h:244:2: note: expanded from macro '__get_user'
>        244 |         __get_user_error(__gu_val, __gu_ptr, __gu_err);         \
>            |         ^
>      arch/riscv/include/asm/uaccess.h:207:2: note: expanded from macro '__get_user_error'
>        207 |         __ge  LD [M]  net/802/psnap.ko
>      t_user_nocheck(x, ptr, __gu_failed);                        \
>            |         ^
>      arch/riscv/include/asm/uaccess.h:196:3: note: expanded from macro '__get_user_nocheck'
>        196 |                 __get_user_8((x), __gu_ptr, label);             \
>            |                 ^
>      arch/riscv/include/asm/uaccess.h:130:2: note: expanded from macro '__get_user_8'
>        130 |         u32 __user *__ptr = (u32 __user *)(ptr);                \
>            |         ^
>
> Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
> ---
>   arch/riscv/include/asm/uaccess.h | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h
> index d472da4450e6..525e50db24f7 100644
> --- a/arch/riscv/include/asm/uaccess.h
> +++ b/arch/riscv/include/asm/uaccess.h
> @@ -127,6 +127,7 @@ do {								\
>   
>   #ifdef CONFIG_CC_HAS_ASM_GOTO_OUTPUT
>   #define __get_user_8(x, ptr, label)				\
> +do {								\
>   	u32 __user *__ptr = (u32 __user *)(ptr);		\
>   	u32 __lo, __hi;						\
>   	asm_goto_output(					\
> @@ -141,7 +142,7 @@ do {								\
>   		: : label);                                     \
>   	(x) = (__typeof__(x))((__typeof__((x) - (x)))(		\
>   		(((u64)__hi << 32) | __lo)));			\
> -
> +} while (0)
>   #else /* !CONFIG_CC_HAS_ASM_GOTO_OUTPUT */
>   #define __get_user_8(x, ptr, label)				\
>   do {								\


I had come up with the same fix so:

Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>


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

* Re: [PATCH] RISC-V: uaccess: Wrap the get_user_8 uaccess macro
  2025-06-11  7:31 ` Alexandre Ghiti
@ 2025-06-12 19:42   ` Palmer Dabbelt
  0 siblings, 0 replies; 4+ messages in thread
From: Palmer Dabbelt @ 2025-06-12 19:42 UTC (permalink / raw)
  To: Alexandre Ghiti
  Cc: linux-riscv, Paul Walmsley, aou, cyrilbur, jszhang, cleger,
	samuel.holland, linux-kernel

On Wed, 11 Jun 2025 00:31:18 PDT (-0700), Alexandre Ghiti wrote:
> On 6/10/25 23:30, Palmer Dabbelt wrote:
>> From: Palmer Dabbelt <palmer@dabbelt.com>
>>
>> I must have lost this rebasing things during the merge window, I know I
>> got it at some point but it's not here now.  Without this I get warnings
>> along the lines of
>>
>>      include/linux/fs.h:3975:15: warning: label followed by a declaration is a C23 extension [-Wc23-extensions]
>>       3975 |         if (unlikely(get_user(c, path)))
>>            |                      ^
>>      arch/riscv/include/asm/uaccess.h:274:3: note: expanded from macro 'get_user'
>>        274 |                 __get_user((x), __p) :                          \
>>            |                 ^
>>      arch/riscv/include/asm/uaccess.h:244:2: note: expanded from macro '__get_user'
>>        244 |         __get_user_error(__gu_val, __gu_ptr, __gu_err);         \
>>            |         ^
>>      arch/riscv/include/asm/uaccess.h:207:2: note: expanded from macro '__get_user_error'
>>        207 |         __ge  LD [M]  net/802/psnap.ko
>>      t_user_nocheck(x, ptr, __gu_failed);                        \
>>            |         ^
>>      arch/riscv/include/asm/uaccess.h:196:3: note: expanded from macro '__get_user_nocheck'
>>        196 |                 __get_user_8((x), __gu_ptr, label);             \
>>            |                 ^
>>      arch/riscv/include/asm/uaccess.h:130:2: note: expanded from macro '__get_user_8'
>>        130 |         u32 __user *__ptr = (u32 __user *)(ptr);                \
>>            |         ^
>>
>> Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
>> ---
>>   arch/riscv/include/asm/uaccess.h | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h
>> index d472da4450e6..525e50db24f7 100644
>> --- a/arch/riscv/include/asm/uaccess.h
>> +++ b/arch/riscv/include/asm/uaccess.h
>> @@ -127,6 +127,7 @@ do {								\
>>
>>   #ifdef CONFIG_CC_HAS_ASM_GOTO_OUTPUT
>>   #define __get_user_8(x, ptr, label)				\
>> +do {								\
>>   	u32 __user *__ptr = (u32 __user *)(ptr);		\
>>   	u32 __lo, __hi;						\
>>   	asm_goto_output(					\
>> @@ -141,7 +142,7 @@ do {								\
>>   		: : label);                                     \
>>   	(x) = (__typeof__(x))((__typeof__((x) - (x)))(		\
>>   		(((u64)__hi << 32) | __lo)));			\
>> -
>> +} while (0)
>>   #else /* !CONFIG_CC_HAS_ASM_GOTO_OUTPUT */
>>   #define __get_user_8(x, ptr, label)				\
>>   do {								\
>
>
> I had come up with the same fix so:
>
> Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>

Thanks, and I guess it should also be

Fixes: f6bff7827a48 ("riscv: uaccess: use 'asm_goto_output' for get_user()")

I'm going to put it on fixes.

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

* Re: [PATCH] RISC-V: uaccess: Wrap the get_user_8 uaccess macro
  2025-06-10 21:30 [PATCH] RISC-V: uaccess: Wrap the get_user_8 uaccess macro Palmer Dabbelt
  2025-06-11  7:31 ` Alexandre Ghiti
@ 2025-06-12 20:10 ` patchwork-bot+linux-riscv
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+linux-riscv @ 2025-06-12 20:10 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: linux-riscv, paul.walmsley, aou, alex, cyrilbur, jszhang, cleger,
	samuel.holland, linux-kernel

Hello:

This patch was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <palmer@dabbelt.com>:

On Tue, 10 Jun 2025 14:30:58 -0700 you wrote:
> From: Palmer Dabbelt <palmer@dabbelt.com>
> 
> I must have lost this rebasing things during the merge window, I know I
> got it at some point but it's not here now.  Without this I get warnings
> along the lines of
> 
>     include/linux/fs.h:3975:15: warning: label followed by a declaration is a C23 extension [-Wc23-extensions]
>      3975 |         if (unlikely(get_user(c, path)))
>           |                      ^
>     arch/riscv/include/asm/uaccess.h:274:3: note: expanded from macro 'get_user'
>       274 |                 __get_user((x), __p) :                          \
>           |                 ^
>     arch/riscv/include/asm/uaccess.h:244:2: note: expanded from macro '__get_user'
>       244 |         __get_user_error(__gu_val, __gu_ptr, __gu_err);         \
>           |         ^
>     arch/riscv/include/asm/uaccess.h:207:2: note: expanded from macro '__get_user_error'
>       207 |         __ge  LD [M]  net/802/psnap.ko
>     t_user_nocheck(x, ptr, __gu_failed);                        \
>           |         ^
>     arch/riscv/include/asm/uaccess.h:196:3: note: expanded from macro '__get_user_nocheck'
>       196 |                 __get_user_8((x), __gu_ptr, label);             \
>           |                 ^
>     arch/riscv/include/asm/uaccess.h:130:2: note: expanded from macro '__get_user_8'
>       130 |         u32 __user *__ptr = (u32 __user *)(ptr);                \
>           |         ^
> 
> [...]

Here is the summary with links:
  - RISC-V: uaccess: Wrap the get_user_8 uaccess macro
    https://git.kernel.org/riscv/c/2aa5801ada29

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] 4+ messages in thread

end of thread, other threads:[~2025-06-12 20:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-10 21:30 [PATCH] RISC-V: uaccess: Wrap the get_user_8 uaccess macro Palmer Dabbelt
2025-06-11  7:31 ` Alexandre Ghiti
2025-06-12 19:42   ` Palmer Dabbelt
2025-06-12 20:10 ` 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

all inboxes | Powered by JetHome®