|
|
@@ -86,11 +86,7 @@ static inline int __access_ok(unsigned long addr, unsigned long size)
|
|
|
|
|
|
static inline int __put_user_fn(size_t size, void __user *ptr, void *x)
|
|
|
{
|
|
|
-#ifdef CONFIG_ARCH_HAS_RAW_COPY_USER
|
|
|
return unlikely(raw_copy_to_user(ptr, x, size)) ? -EFAULT : 0;
|
|
|
-#else
|
|
|
- return unlikely(__copy_to_user(ptr, x, size)) ? -EFAULT : 0;
|
|
|
-#endif
|
|
|
}
|
|
|
|
|
|
#define __put_user_fn(sz, u, k) __put_user_fn(sz, u, k)
|
|
|
@@ -151,11 +147,7 @@ extern int __put_user_bad(void) __attribute__((noreturn));
|
|
|
#ifndef __get_user_fn
|
|
|
static inline int __get_user_fn(size_t size, const void __user *ptr, void *x)
|
|
|
{
|
|
|
-#ifdef CONFIG_ARCH_HAS_RAW_COPY_USER
|
|
|
return unlikely(raw_copy_from_user(x, ptr, size)) ? -EFAULT : 0;
|
|
|
-#else
|
|
|
- return unlikely(__copy_from_user(x, ptr, size)) ? -EFAULT : 0;
|
|
|
-#endif
|
|
|
}
|
|
|
|
|
|
#define __get_user_fn(sz, u, k) __get_user_fn(sz, u, k)
|
|
|
@@ -164,39 +156,6 @@ static inline int __get_user_fn(size_t size, const void __user *ptr, void *x)
|
|
|
|
|
|
extern int __get_user_bad(void) __attribute__((noreturn));
|
|
|
|
|
|
-#ifndef CONFIG_ARCH_HAS_RAW_COPY_USER
|
|
|
-
|
|
|
-#ifndef __copy_from_user_inatomic
|
|
|
-#define __copy_from_user_inatomic __copy_from_user
|
|
|
-#endif
|
|
|
-
|
|
|
-#ifndef __copy_to_user_inatomic
|
|
|
-#define __copy_to_user_inatomic __copy_to_user
|
|
|
-#endif
|
|
|
-
|
|
|
-static inline long copy_from_user(void *to,
|
|
|
- const void __user * from, unsigned long n)
|
|
|
-{
|
|
|
- unsigned long res = 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;
|
|
|
-}
|
|
|
-
|
|
|
-static inline long copy_to_user(void __user *to,
|
|
|
- const void *from, unsigned long n)
|
|
|
-{
|
|
|
- might_fault();
|
|
|
- if (access_ok(VERIFY_WRITE, to, n))
|
|
|
- return __copy_to_user(to, from, n);
|
|
|
- else
|
|
|
- return n;
|
|
|
-}
|
|
|
-#endif
|
|
|
-
|
|
|
/*
|
|
|
* Copy a null terminated string from userspace.
|
|
|
*/
|