mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
frv: switch to RAW_COPY_USER
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
9a7513cfa2
commit
48f666c986
2 changed files with 26 additions and 36 deletions
|
@ -16,6 +16,7 @@ config FRV
|
|||
select OLD_SIGACTION
|
||||
select HAVE_DEBUG_STACKOVERFLOW
|
||||
select ARCH_NO_COHERENT_DMA_MMAP
|
||||
select ARCH_HAS_RAW_COPY_USER
|
||||
|
||||
config ZONE_DMA
|
||||
bool
|
||||
|
|
|
@ -233,23 +233,44 @@ do { \
|
|||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
#define ____force(x) (__force void *)(void __user *)(x)
|
||||
#ifdef CONFIG_MMU
|
||||
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 __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 __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
|
||||
|
||||
static inline unsigned long
|
||||
raw_copy_from_user(void *to, const void __user *from, unsigned long n)
|
||||
{
|
||||
#ifdef CONFIG_MMU
|
||||
return __memcpy_user(to, (__force const void *)from, n);
|
||||
#else
|
||||
memcpy(to, (__force const void *)from, n);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
raw_copy_to_user(void __user *to, const void *from, unsigned long n)
|
||||
{
|
||||
#ifdef CONFIG_MMU
|
||||
return __memcpy_user((__force void *)to, from, n);
|
||||
#else
|
||||
memcpy((__force void *)to, from, n);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
#define INLINE_COPY_TO_USER
|
||||
#define INLINE_COPY_FROM_USER
|
||||
|
||||
static inline unsigned long __must_check
|
||||
clear_user(void __user *to, unsigned long n)
|
||||
{
|
||||
|
@ -258,38 +279,6 @@ clear_user(void __user *to, unsigned long n)
|
|||
return n;
|
||||
}
|
||||
|
||||
static inline unsigned long __must_check
|
||||
__copy_to_user(void __user *to, const void *from, unsigned long n)
|
||||
{
|
||||
might_fault();
|
||||
return __copy_to_user_inatomic(to, from, n);
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
__copy_from_user(void *to, const void __user *from, unsigned long n)
|
||||
{
|
||||
might_fault();
|
||||
return __copy_from_user_inatomic(to, from, n);
|
||||
}
|
||||
|
||||
static inline long copy_from_user(void *to, const void __user *from, unsigned long n)
|
||||
{
|
||||
unsigned long ret = n;
|
||||
|
||||
if (likely(__access_ok(from, n)))
|
||||
ret = __copy_from_user(to, from, n);
|
||||
|
||||
if (unlikely(ret != 0))
|
||||
memset(to + (n - ret), 0, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline long copy_to_user(void __user *to, const void *from, unsigned long n)
|
||||
{
|
||||
return likely(__access_ok(to, n)) ? __copy_to_user(to, from, n) : n;
|
||||
}
|
||||
|
||||
extern long strncpy_from_user(char *dst, const char __user *src, long count);
|
||||
extern long strnlen_user(const char __user *src, long count);
|
||||
|
||||
|
|
Loading…
Reference in a new issue