summaryrefslogtreecommitdiff
path: root/arch/frv/include/asm/uaccess.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2016-09-26 12:12:45 +0300
committerIngo Molnar <mingo@kernel.org>2016-09-26 12:12:45 +0300
commit6fae257f0b294d7abe7adfb08277bfd5472ed717 (patch)
tree22ee5582cff79487dac0d26bbc07593980472428 /arch/frv/include/asm/uaccess.h
parent7cc4ef8ed132e72ba44804cae3ddb2587ff757d6 (diff)
parent08895a8b6b06ed2323cd97a36ee40a116b3db8ed (diff)
downloadlinux-6fae257f0b294d7abe7adfb08277bfd5472ed717.tar.xz
Merge tag 'v4.8-rc8' into ras/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/frv/include/asm/uaccess.h')
-rw-r--r--arch/frv/include/asm/uaccess.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/arch/frv/include/asm/uaccess.h b/arch/frv/include/asm/uaccess.h
index 3ac9a59d65d4..87d9e34c5df8 100644
--- a/arch/frv/include/asm/uaccess.h
+++ b/arch/frv/include/asm/uaccess.h
@@ -263,19 +263,25 @@ do { \
extern long __memset_user(void *dst, unsigned long count);
extern long __memcpy_user(void *dst, const void *src, unsigned long count);
-#define clear_user(dst,count) __memset_user(____force(dst), (count))
+#define __clear_user(dst,count) __memset_user(____force(dst), (count))
#define __copy_from_user_inatomic(to, from, n) __memcpy_user((to), ____force(from), (n))
#define __copy_to_user_inatomic(to, from, n) __memcpy_user(____force(to), (from), (n))
#else
-#define clear_user(dst,count) (memset(____force(dst), 0, (count)), 0)
+#define __clear_user(dst,count) (memset(____force(dst), 0, (count)), 0)
#define __copy_from_user_inatomic(to, from, n) (memcpy((to), ____force(from), (n)), 0)
#define __copy_to_user_inatomic(to, from, n) (memcpy(____force(to), (from), (n)), 0)
#endif
-#define __clear_user clear_user
+static inline unsigned long __must_check
+clear_user(void __user *to, unsigned long n)
+{
+ if (likely(__access_ok(to, n)))
+ n = __clear_user(to, n);
+ return n;
+}
static inline unsigned long __must_check
__copy_to_user(void __user *to, const void *from, unsigned long n)