]> Git Repo - J-linux.git/commitdiff
riscv: uaccess: fix type of 0 variable on error in get_user()
authorBen Dooks <[email protected]>
Thu, 29 Dec 2022 17:05:45 +0000 (17:05 +0000)
committerPalmer Dabbelt <[email protected]>
Thu, 5 Jan 2023 20:30:41 +0000 (12:30 -0800)
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]>
arch/riscv/include/asm/uaccess.h

index 855450bed9f52c2b7b06360dc5976b5519e5592b..ec0cab9fbddd0da98cb415af2732a4ede083886b 100644 (file)
@@ -165,7 +165,7 @@ do {                                                                \
        might_fault();                                          \
        access_ok(__p, sizeof(*__p)) ?          \
                __get_user((x), __p) :                          \
-               ((x) = 0, -EFAULT);                             \
+               ((x) = (__force __typeof__(x))0, -EFAULT);      \
 })
 
 #define __put_user_asm(insn, x, ptr, err)                      \
This page took 0.04497 seconds and 4 git commands to generate.