aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/asm-generic/uaccess.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-09-07 07:58:20 +0200
committerPalmer Dabbelt <palmerdabbelt@google.com>2020-10-04 10:26:57 -0700
commit2d2d255467d4ea927fbf606c8b584512edee0f7b (patch)
tree0decbcb0bf79ac6049f32d1367175f7bb1630362 /include/asm-generic/uaccess.h
parentasm-generic: improve the nommu {get,put}_user handling (diff)
downloadwireguard-linux-2d2d255467d4ea927fbf606c8b584512edee0f7b.tar.xz
wireguard-linux-2d2d255467d4ea927fbf606c8b584512edee0f7b.zip
asm-generic: add nommu implementations of __{get,put}_kernel_nofault
Add native implementations of __{get,put}_kernel_nofault using {get,put}_unaligned, just like the {get,put}_user implementations. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Diffstat (limited to 'include/asm-generic/uaccess.h')
-rw-r--r--include/asm-generic/uaccess.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
index 6de5f524e9e6..b367f339be1a 100644
--- a/include/asm-generic/uaccess.h
+++ b/include/asm-generic/uaccess.h
@@ -61,6 +61,22 @@ static inline int __put_user_fn(size_t size, void __user *to, void *from)
}
#define __put_user_fn(sz, u, k) __put_user_fn(sz, u, k)
+#define __get_kernel_nofault(dst, src, type, err_label) \
+do { \
+ *((type *)dst) = get_unaligned((type *)(src)); \
+ if (0) /* make sure the label looks used to the compiler */ \
+ goto err_label; \
+} while (0)
+
+#define __put_kernel_nofault(dst, src, type, err_label) \
+do { \
+ put_unaligned(*((type *)src), (type *)(dst)); \
+ if (0) /* make sure the label looks used to the compiler */ \
+ goto err_label; \
+} while (0)
+
+#define HAVE_GET_KERNEL_NOFAULT 1
+
static inline __must_check unsigned long
raw_copy_from_user(void *to, const void __user * from, unsigned long n)
{