Commit d4b8c2e5 authored by Al Viro's avatar Al Viro Committed by Greg Kroah-Hartman

avr32: fix copy_from_user()

commit 8630c322 upstream.

really ugly, but apparently avr32 compilers turns access_ok() into
something so bad that they want it in assembler.  Left that way,
zeroing added in inline wrapper.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 42e3ee6d
...@@ -74,7 +74,7 @@ extern __kernel_size_t __copy_user(void *to, const void *from, ...@@ -74,7 +74,7 @@ extern __kernel_size_t __copy_user(void *to, const void *from,
extern __kernel_size_t copy_to_user(void __user *to, const void *from, extern __kernel_size_t copy_to_user(void __user *to, const void *from,
__kernel_size_t n); __kernel_size_t n);
extern __kernel_size_t copy_from_user(void *to, const void __user *from, extern __kernel_size_t ___copy_from_user(void *to, const void __user *from,
__kernel_size_t n); __kernel_size_t n);
static inline __kernel_size_t __copy_to_user(void __user *to, const void *from, static inline __kernel_size_t __copy_to_user(void __user *to, const void *from,
...@@ -88,6 +88,15 @@ static inline __kernel_size_t __copy_from_user(void *to, ...@@ -88,6 +88,15 @@ static inline __kernel_size_t __copy_from_user(void *to,
{ {
return __copy_user(to, (const void __force *)from, n); return __copy_user(to, (const void __force *)from, n);
} }
static inline __kernel_size_t copy_from_user(void *to,
const void __user *from,
__kernel_size_t n)
{
size_t res = ___copy_from_user(to, from, n);
if (unlikely(res))
memset(to + (n - res), 0, res);
return res;
}
#define __copy_to_user_inatomic __copy_to_user #define __copy_to_user_inatomic __copy_to_user
#define __copy_from_user_inatomic __copy_from_user #define __copy_from_user_inatomic __copy_from_user
......
...@@ -36,7 +36,7 @@ EXPORT_SYMBOL(copy_page); ...@@ -36,7 +36,7 @@ EXPORT_SYMBOL(copy_page);
/* /*
* Userspace access stuff. * Userspace access stuff.
*/ */
EXPORT_SYMBOL(copy_from_user); EXPORT_SYMBOL(___copy_from_user);
EXPORT_SYMBOL(copy_to_user); EXPORT_SYMBOL(copy_to_user);
EXPORT_SYMBOL(__copy_user); EXPORT_SYMBOL(__copy_user);
EXPORT_SYMBOL(strncpy_from_user); EXPORT_SYMBOL(strncpy_from_user);
......
...@@ -25,11 +25,11 @@ ...@@ -25,11 +25,11 @@
.align 1 .align 1
.global copy_from_user .global copy_from_user
.type copy_from_user, @function .type copy_from_user, @function
copy_from_user: ___copy_from_user:
branch_if_kernel r8, __copy_user branch_if_kernel r8, __copy_user
ret_if_privileged r8, r11, r10, r10 ret_if_privileged r8, r11, r10, r10
rjmp __copy_user rjmp __copy_user
.size copy_from_user, . - copy_from_user .size ___copy_from_user, . - ___copy_from_user
.global copy_to_user .global copy_to_user
.type copy_to_user, @function .type copy_to_user, @function
......
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