提交 d491afb8 编写于 作者: A Al Viro

microblaze: switch to RAW_COPY_USER

[kudos to Piotr Sroka for spotting a braino in the previous variant]
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 730132e7
...@@ -34,6 +34,7 @@ config MICROBLAZE ...@@ -34,6 +34,7 @@ config MICROBLAZE
select TRACING_SUPPORT select TRACING_SUPPORT
select VIRT_TO_BUS select VIRT_TO_BUS
select CPU_NO_EFFICIENT_FFS select CPU_NO_EFFICIENT_FFS
select ARCH_HAS_RAW_COPY_USER
config SWAP config SWAP
def_bool n def_bool n
......
...@@ -336,39 +336,19 @@ extern long __user_bad(void); ...@@ -336,39 +336,19 @@ extern long __user_bad(void);
__gu_err; \ __gu_err; \
}) })
static inline unsigned long
/* copy_to_from_user */ raw_copy_from_user(void *to, const void __user *from, unsigned long n)
#define __copy_from_user(to, from, n) \
__copy_tofrom_user((__force void __user *)(to), \
(void __user *)(from), (n))
#define __copy_from_user_inatomic(to, from, n) \
__copy_from_user((to), (from), (n))
static inline long copy_from_user(void *to,
const void __user *from, unsigned long n)
{ {
unsigned long res = n; return __copy_tofrom_user((__force void __user *)to, from, n);
might_fault();
if (likely(access_ok(VERIFY_READ, from, n)))
res = __copy_from_user(to, from, n);
if (unlikely(res))
memset(to + (n - res), 0, res);
return res;
} }
#define __copy_to_user(to, from, n) \ static inline unsigned long
__copy_tofrom_user((void __user *)(to), \ raw_copy_to_user(void __user *to, const void *from, unsigned long n)
(__force const void __user *)(from), (n))
#define __copy_to_user_inatomic(to, from, n) __copy_to_user((to), (from), (n))
static inline long copy_to_user(void __user *to,
const void *from, unsigned long n)
{ {
might_fault(); return __copy_tofrom_user(to, (__force const void __user *)from, n);
if (access_ok(VERIFY_WRITE, to, n))
return __copy_to_user(to, from, n);
return n;
} }
#define INLINE_COPY_FROM_USER
#define INLINE_COPY_TO_USER
/* /*
* Copy a null terminated string from userspace. * Copy a null terminated string from userspace.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册