mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 06:31:49 +00:00
riscv: implement __get_kernel_nofault and __put_user_nofault
Implement the non-faulting kernel access helpers directly instead of abusing the uaccess routines under set_fs(KERNEL_DS). Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
This commit is contained in:
parent
f289a34811
commit
d464118cdc
@ -486,6 +486,26 @@ unsigned long __must_check clear_user(void __user *to, unsigned long n)
|
|||||||
__ret; \
|
__ret; \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
#define HAVE_GET_KERNEL_NOFAULT
|
||||||
|
|
||||||
|
#define __get_kernel_nofault(dst, src, type, err_label) \
|
||||||
|
do { \
|
||||||
|
long __kr_err; \
|
||||||
|
\
|
||||||
|
__get_user_nocheck(*((type *)(dst)), (type *)(src), __kr_err); \
|
||||||
|
if (unlikely(__kr_err)) \
|
||||||
|
goto err_label; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define __put_kernel_nofault(dst, src, type, err_label) \
|
||||||
|
do { \
|
||||||
|
long __kr_err; \
|
||||||
|
\
|
||||||
|
__put_user_nocheck(*((type *)(dst)), (type *)(src), __kr_err); \
|
||||||
|
if (unlikely(__kr_err)) \
|
||||||
|
goto err_label; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#else /* CONFIG_MMU */
|
#else /* CONFIG_MMU */
|
||||||
#include <asm-generic/uaccess.h>
|
#include <asm-generic/uaccess.h>
|
||||||
#endif /* CONFIG_MMU */
|
#endif /* CONFIG_MMU */
|
||||||
|
Loading…
Reference in New Issue
Block a user