RISC-V: uaccess: Wrap the get_user_8 uaccess macro
Palmer Dabbelt
maintainerPATCH 1/1 RISC-V: uaccess: Wrap the get_user_8 uaccess macro
From: Palmer Dabbelt <[email protected]>
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); \
| ^--- arch/riscv/include/asm/uaccess.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/riscv/include/asm/uaccess.h +2 -1
@@ -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 { \
Signature · 1 line
2.39.5 (Apple Git-154)
Quoted 44 lines · Palmer Dabbelt
From: Palmer Dabbelt <[email protected]>
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 <[email protected]>--- arch/riscv/include/asm/uaccess.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/riscv/include/asm/uaccess.h +1
-0@@ -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( \
arch/riscv/include/asm/uaccess.h do { \ · line 148
Quoted 8 lines
arch/riscv/include/asm/uaccess.h +1
-1@@ -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:
Palmer Dabbelt
maintainerQuoted 57 lines · Alexandre Ghiti
Quoted 44 lines · Palmer Dabbelt
From: Palmer Dabbelt <[email protected]>
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 <[email protected]>--- arch/riscv/include/asm/uaccess.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/riscv/include/asm/uaccess.h +1
-0@@ -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( \arch/riscv/include/asm/uaccess.h do { \ · line 148
Quoted 8 lines
arch/riscv/include/asm/uaccess.h +1
-1@@ -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:
Quoted 1 line
Reviewed-by Alexandre Ghiti <[email protected]>
Thanks, and I guess it should also be
I'm going to put it on fixes.
This patch was applied to riscv/linux.git (fixes) by Palmer Dabbelt <[email protected]>:
Hello:
This patch was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <[email protected]>:
Quoted 26 lines · On Tue, 10 Jun 2025 14:30:58 -0700 you wrote:
From: Palmer Dabbelt <[email protected]>
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); \ | ^
Quoted 1 line
[...]
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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html