From 37f587ade32a98ed521b51135e4e2c6fc7ca5f11 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 10 Jan 2023 09:26:24 +0100 Subject: [PATCH] 4.19-stable patches added patches: riscv-uaccess-fix-type-of-0-variable-on-error-in-get_user.patch --- ...e-of-0-variable-on-error-in-get_user.patch | 36 +++++++++++++++++++ queue-4.19/series | 1 + 2 files changed, 37 insertions(+) create mode 100644 queue-4.19/riscv-uaccess-fix-type-of-0-variable-on-error-in-get_user.patch diff --git a/queue-4.19/riscv-uaccess-fix-type-of-0-variable-on-error-in-get_user.patch b/queue-4.19/riscv-uaccess-fix-type-of-0-variable-on-error-in-get_user.patch new file mode 100644 index 00000000000..5ecf0d96038 --- /dev/null +++ b/queue-4.19/riscv-uaccess-fix-type-of-0-variable-on-error-in-get_user.patch @@ -0,0 +1,36 @@ +From b9b916aee6715cd7f3318af6dc360c4729417b94 Mon Sep 17 00:00:00 2001 +From: Ben Dooks +Date: Thu, 29 Dec 2022 17:05:45 +0000 +Subject: riscv: uaccess: fix type of 0 variable on error in get_user() + +From: Ben Dooks + +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 +Reviewed-by: Palmer Dabbelt +Link: https://lore.kernel.org/r/20221229170545.718264-1-ben-linux@fluff.org +Cc: stable@vger.kernel.org +Signed-off-by: Palmer Dabbelt +Signed-off-by: Greg Kroah-Hartman +--- + arch/riscv/include/asm/uaccess.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/riscv/include/asm/uaccess.h ++++ b/arch/riscv/include/asm/uaccess.h +@@ -260,7 +260,7 @@ do { \ + might_fault(); \ + access_ok(VERIFY_READ, __p, sizeof(*__p)) ? \ + __get_user((x), __p) : \ +- ((x) = 0, -EFAULT); \ ++ ((x) = (__force __typeof__(x))0, -EFAULT); \ + }) + + #define __put_user_asm(insn, x, ptr, err) \ diff --git a/queue-4.19/series b/queue-4.19/series index c5a03bb26bd..aa1ce72e40b 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -455,3 +455,4 @@ udf-fix-extension-of-the-last-extent-in-the-file.patch asoc-intel-bytcr_rt5640-add-quirk-for-the-advantech-.patch x86-bugs-flush-ibp-in-ib_prctl_set.patch nfsd-fix-handling-of-readdir-in-v4root-vs.-mount-upcall-timeout.patch +riscv-uaccess-fix-type-of-0-variable-on-error-in-get_user.patch -- 2.47.3