Commit 29be02eb authored by Al Viro's avatar Al Viro

m68k: switch to RAW_COPY_USER

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 7cefa5a0
...@@ -22,6 +22,7 @@ config M68K ...@@ -22,6 +22,7 @@ config M68K
select MODULES_USE_ELF_RELA select MODULES_USE_ELF_RELA
select OLD_SIGSUSPEND3 select OLD_SIGSUSPEND3
select OLD_SIGACTION select OLD_SIGACTION
select ARCH_HAS_RAW_COPY_USER
config RWSEM_GENERIC_SPINLOCK config RWSEM_GENERIC_SPINLOCK
bool bool
......
...@@ -356,28 +356,23 @@ __constant_copy_to_user(void __user *to, const void *from, unsigned long n) ...@@ -356,28 +356,23 @@ __constant_copy_to_user(void __user *to, const void *from, unsigned long n)
return res; return res;
} }
#define __copy_from_user(to, from, n) \ static inline unsigned long
(__builtin_constant_p(n) ? \ raw_copy_from_user(void *to, const void __user *from, unsigned long n)
__constant_copy_from_user(to, from, n) : \ {
__generic_copy_from_user(to, from, n)) if (__builtin_constant_p(n))
return __constant_copy_from_user(to, from, n);
#define __copy_to_user(to, from, n) \ return __generic_copy_from_user(to, from, n);
(__builtin_constant_p(n) ? \ }
__constant_copy_to_user(to, from, n) : \
__generic_copy_to_user(to, from, n))
#define __copy_to_user_inatomic __copy_to_user
#define __copy_from_user_inatomic __copy_from_user
static inline unsigned long static inline unsigned long
copy_from_user(void *to, const void __user *from, unsigned long n) raw_copy_to_user(void __user *to, const void *from, unsigned long n)
{ {
unsigned long res = __copy_from_user_inatomic(to, from, n); if (__builtin_constant_p(n))
if (unlikely(res)) return __constant_copy_to_user(to, from, n);
memset(to + (n - res), 0, res); return __generic_copy_to_user(to, from, n);
return res;
} }
#define copy_to_user(to, from, n) __copy_to_user(to, from, n) #define INLINE_COPY_FROM_USER
#define INLINE_COPY_TO_USER
#define user_addr_max() \ #define user_addr_max() \
(uaccess_kernel() ? ~0UL : TASK_SIZE) (uaccess_kernel() ? ~0UL : TASK_SIZE)
......
...@@ -101,13 +101,21 @@ extern int __get_user_bad(void); ...@@ -101,13 +101,21 @@ extern int __get_user_bad(void);
: "=d" (x) \ : "=d" (x) \
: "m" (*__ptr(ptr))) : "m" (*__ptr(ptr)))
#define copy_from_user(to, from, n) (memcpy(to, from, n), 0) static inline unsigned long
#define copy_to_user(to, from, n) (memcpy(to, from, n), 0) raw_copy_from_user(void *to, const void __user *from, unsigned long n)
{
memcpy(to, (__force const void *)from, n);
return 0;
}
#define __copy_from_user(to, from, n) copy_from_user(to, from, n) static inline unsigned long
#define __copy_to_user(to, from, n) copy_to_user(to, from, n) raw_copy_to_user(void __user *to, const void *from, unsigned long n)
#define __copy_to_user_inatomic __copy_to_user {
#define __copy_from_user_inatomic __copy_from_user memcpy((__force void *)to, from, n);
return 0;
}
#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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment