Skip to content

Commit d080a08

Browse files
SiFiveHollandpalmer-dabbelt
authored andcommitted
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: [email protected] Fixes: d464118 ("riscv: implement __get_kernel_nofault and __put_user_nofault") Signed-off-by: Samuel Holland <[email protected]> Reviewed-by: Alexandre Ghiti <[email protected]> Reviewed-by: Charlie Jenkins <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 674bc01 commit d080a08

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/riscv/include/asm/uaccess.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ unsigned long __must_check clear_user(void __user *to, unsigned long n)
319319

320320
#define __get_kernel_nofault(dst, src, type, err_label) \
321321
do { \
322-
long __kr_err; \
322+
long __kr_err = 0; \
323323
\
324324
__get_user_nocheck(*((type *)(dst)), (type *)(src), __kr_err); \
325325
if (unlikely(__kr_err)) \
@@ -328,7 +328,7 @@ do { \
328328

329329
#define __put_kernel_nofault(dst, src, type, err_label) \
330330
do { \
331-
long __kr_err; \
331+
long __kr_err = 0; \
332332
\
333333
__put_user_nocheck(*((type *)(src)), (type *)(dst), __kr_err); \
334334
if (unlikely(__kr_err)) \

0 commit comments

Comments
 (0)