summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2022-12-29 17:05:45 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-01-14 10:16:49 +0100
commitbc847857fbd8973b7e106b9abd920e409a051aae (patch)
treefe0d02e423c79a85311adbf99880176f27d13445
parentf64e56fb285a4684d287e5325e930e3fce312326 (diff)
downloadlinux-bc847857fbd8973b7e106b9abd920e409a051aae.tar.gz
linux-bc847857fbd8973b7e106b9abd920e409a051aae.tar.bz2
linux-bc847857fbd8973b7e106b9abd920e409a051aae.zip
riscv: uaccess: fix type of 0 variable on error in get_user()
commit b9b916aee6715cd7f3318af6dc360c4729417b94 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>
-rw-r--r--arch/riscv/include/asm/uaccess.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h
index f944062c9d99..66af6abfe8af 100644
--- a/arch/riscv/include/asm/uaccess.h
+++ b/arch/riscv/include/asm/uaccess.h
@@ -216,7 +216,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) \