Skip to content

Commit 620a229

Browse files
Ben Dooksgregkh
authored andcommitted
riscv: uaccess: fix type of 0 variable on error in get_user()
commit b9b916a upstream. 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 <ben-linux@fluff.org> Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com> Link: https://lore.kernel.org/r/20221229170545.718264-1-ben-linux@fluff.org Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8e05a99 commit 620a229

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
@@ -216,7 +216,7 @@ do { \
216216
might_fault(); \
217217
access_ok(__p, sizeof(*__p)) ? \
218218
__get_user((x), __p) : \
219-
((x) = 0, -EFAULT); \
219+
((x) = (__force __typeof__(x))0, -EFAULT); \
220220
})
221221

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

0 commit comments

Comments
 (0)