summaryrefslogtreecommitdiffstats
path: root/include/asm-generic/uaccess.h
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2017-03-21 02:56:06 +0100
committerAl Viro <viro@zeniv.linux.org.uk>2017-03-29 00:22:11 +0200
commitd597580d373774b1bdab84b3d26ff0b55162b916 (patch)
treeebbd7de012fcb731c40c67791e4e5e370844f70c /include/asm-generic/uaccess.h
parentasm-generic: zero in __get_user(), not __get_user_fn() (diff)
downloadlinux-d597580d373774b1bdab84b3d26ff0b55162b916.tar.xz
linux-d597580d373774b1bdab84b3d26ff0b55162b916.zip
generic ...copy_..._user primitives
provide raw_copy_..._user() and select ARCH_HAS_RAW_COPY_USER to use those. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/asm-generic/uaccess.h')
-rw-r--r--include/asm-generic/uaccess.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
index bd7a05e9582b..d65c311eb128 100644
--- a/include/asm-generic/uaccess.h
+++ b/include/asm-generic/uaccess.h
@@ -86,7 +86,11 @@ static inline int __access_ok(unsigned long addr, unsigned long size)
static inline int __put_user_fn(size_t size, void __user *ptr, void *x)
{
+#ifdef CONFIG_ARCH_HAS_RAW_COPY_USER
+ return unlikely(raw_copy_to_user(ptr, x, size)) ? -EFAULT : 0;
+#else
return unlikely(__copy_to_user(ptr, x, size)) ? -EFAULT : 0;
+#endif
}
#define __put_user_fn(sz, u, k) __put_user_fn(sz, u, k)
@@ -147,7 +151,11 @@ extern int __put_user_bad(void) __attribute__((noreturn));
#ifndef __get_user_fn
static inline int __get_user_fn(size_t size, const void __user *ptr, void *x)
{
+#ifdef CONFIG_ARCH_HAS_RAW_COPY_USER
+ return unlikely(raw_copy_from_user(x, ptr, size)) ? -EFAULT : 0;
+#else
return unlikely(__copy_from_user(x, ptr, size)) ? -EFAULT : 0;
+#endif
}
#define __get_user_fn(sz, u, k) __get_user_fn(sz, u, k)
@@ -156,6 +164,8 @@ static inline int __get_user_fn(size_t size, const void __user *ptr, void *x)
extern int __get_user_bad(void) __attribute__((noreturn));
+#ifndef CONFIG_ARCH_HAS_RAW_COPY_USER
+
#ifndef __copy_from_user_inatomic
#define __copy_from_user_inatomic __copy_from_user
#endif
@@ -185,6 +195,7 @@ static inline long copy_to_user(void __user *to,
else
return n;
}
+#endif
/*
* Copy a null terminated string from userspace.