Skip to content

Commit b9b916a

Browse files
Ben Dookspalmer-dabbelt
authored andcommitted
riscv: uaccess: fix type of 0 variable on error in get_user()
If the get_user(x, ptr) has x as a pointer, then the setting of (x) = 0 is going to produce the following sparse warning, so fix this by forcing the type of 'x' when access_ok() fails. fs/aio.c:2073:21: warning: Using plain integer as NULL pointer Signed-off-by: Ben Dooks <[email protected]> Reviewed-by: Palmer Dabbelt <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: [email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent b2d473a commit b9b916a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/riscv/include/asm/uaccess.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ do { \
165165
might_fault(); \
166166
access_ok(__p, sizeof(*__p)) ? \
167167
__get_user((x), __p) : \
168-
((x) = 0, -EFAULT); \
168+
((x) = (__force __typeof__(x))0, -EFAULT); \
169169
})
170170

171171
#define __put_user_asm(insn, x, ptr, err) \

0 commit comments

Comments
 (0)