riscv: Fix spurious errors from __get/put_kernel_nofault
These macros did not initialize __kr_err, so they could fail even if
the access did not fault.
Cc: stable@vger.kernel.org
Fixes: d464118cdc
("riscv: implement __get_kernel_nofault and __put_user_nofault")
Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
Link: https://lore.kernel.org/r/20240312022030.320789-1-samuel.holland@sifive.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
This commit is contained in:
parent
674bc0168e
commit
d080a08b06
@ -319,7 +319,7 @@ unsigned long __must_check clear_user(void __user *to, unsigned long n)
|
|||||||
|
|
||||||
#define __get_kernel_nofault(dst, src, type, err_label) \
|
#define __get_kernel_nofault(dst, src, type, err_label) \
|
||||||
do { \
|
do { \
|
||||||
long __kr_err; \
|
long __kr_err = 0; \
|
||||||
\
|
\
|
||||||
__get_user_nocheck(*((type *)(dst)), (type *)(src), __kr_err); \
|
__get_user_nocheck(*((type *)(dst)), (type *)(src), __kr_err); \
|
||||||
if (unlikely(__kr_err)) \
|
if (unlikely(__kr_err)) \
|
||||||
@ -328,7 +328,7 @@ do { \
|
|||||||
|
|
||||||
#define __put_kernel_nofault(dst, src, type, err_label) \
|
#define __put_kernel_nofault(dst, src, type, err_label) \
|
||||||
do { \
|
do { \
|
||||||
long __kr_err; \
|
long __kr_err = 0; \
|
||||||
\
|
\
|
||||||
__put_user_nocheck(*((type *)(src)), (type *)(dst), __kr_err); \
|
__put_user_nocheck(*((type *)(src)), (type *)(dst), __kr_err); \
|
||||||
if (unlikely(__kr_err)) \
|
if (unlikely(__kr_err)) \
|
||||||
|
Loading…
Reference in New Issue
Block a user