Commit f64fd180 authored by Al Viro's avatar Al Viro

parisc: switch to RAW_COPY_USER

... and remove dead declarations, while we are at it
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent bee3f412
...@@ -41,6 +41,7 @@ config PARISC ...@@ -41,6 +41,7 @@ config PARISC
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
select ARCH_NO_COHERENT_DMA_MMAP select ARCH_NO_COHERENT_DMA_MMAP
select CPU_NO_EFFICIENT_FFS select CPU_NO_EFFICIENT_FFS
select ARCH_HAS_RAW_COPY_USER
help help
The PA-RISC microprocessor is designed by Hewlett-Packard and used The PA-RISC microprocessor is designed by Hewlett-Packard and used
......
...@@ -187,9 +187,6 @@ struct exception_data { ...@@ -187,9 +187,6 @@ struct exception_data {
* Complex access routines -- external declarations * Complex access routines -- external declarations
*/ */
extern unsigned long lcopy_to_user(void __user *, const void *, unsigned long);
extern unsigned long lcopy_from_user(void *, const void __user *, unsigned long);
extern unsigned long lcopy_in_user(void __user *, const void __user *, unsigned long);
extern long strncpy_from_user(char *, const char __user *, long); extern long strncpy_from_user(char *, const char __user *, long);
extern unsigned lclear_user(void __user *, unsigned long); extern unsigned lclear_user(void __user *, unsigned long);
extern long lstrnlen_user(const char __user *, long); extern long lstrnlen_user(const char __user *, long);
...@@ -203,59 +200,14 @@ extern long lstrnlen_user(const char __user *, long); ...@@ -203,59 +200,14 @@ extern long lstrnlen_user(const char __user *, long);
#define clear_user lclear_user #define clear_user lclear_user
#define __clear_user lclear_user #define __clear_user lclear_user
unsigned long __must_check __copy_to_user(void __user *dst, const void *src, unsigned long __must_check raw_copy_to_user(void __user *dst, const void *src,
unsigned long len); unsigned long len);
unsigned long __must_check __copy_from_user(void *dst, const void __user *src, unsigned long __must_check raw_copy_from_user(void *dst, const void __user *src,
unsigned long len); unsigned long len);
unsigned long copy_in_user(void __user *dst, const void __user *src, unsigned long __must_check raw_copy_in_user(void __user *dst, const void __user *src,
unsigned long len); unsigned long len);
#define __copy_in_user copy_in_user #define INLINE_COPY_TO_USER
#define __copy_to_user_inatomic __copy_to_user #define INLINE_COPY_FROM_USER
#define __copy_from_user_inatomic __copy_from_user
extern void __compiletime_error("usercopy buffer size is too small")
__bad_copy_user(void);
static inline void copy_user_overflow(int size, unsigned long count)
{
WARN(1, "Buffer overflow detected (%d < %lu)!\n", size, count);
}
static __always_inline unsigned long __must_check
copy_from_user(void *to, const void __user *from, unsigned long n)
{
int sz = __compiletime_object_size(to);
unsigned long ret = n;
if (likely(sz < 0 || sz >= n)) {
check_object_size(to, n, false);
ret = __copy_from_user(to, from, n);
} else if (!__builtin_constant_p(n))
copy_user_overflow(sz, n);
else
__bad_copy_user();
if (unlikely(ret))
memset(to + (n - ret), 0, ret);
return ret;
}
static __always_inline unsigned long __must_check
copy_to_user(void __user *to, const void *from, unsigned long n)
{
int sz = __compiletime_object_size(from);
if (likely(sz < 0 || sz >= n)) {
check_object_size(from, n, true);
n = __copy_to_user(to, from, n);
} else if (!__builtin_constant_p(n))
copy_user_overflow(sz, n);
else
__bad_copy_user();
return n;
}
struct pt_regs; struct pt_regs;
int fixup_exception(struct pt_regs *regs); int fixup_exception(struct pt_regs *regs);
......
...@@ -36,25 +36,25 @@ DECLARE_PER_CPU(struct exception_data, exception_data); ...@@ -36,25 +36,25 @@ DECLARE_PER_CPU(struct exception_data, exception_data);
extern unsigned long pa_memcpy(void *dst, const void *src, extern unsigned long pa_memcpy(void *dst, const void *src,
unsigned long len); unsigned long len);
unsigned long __copy_to_user(void __user *dst, const void *src, unsigned long raw_copy_to_user(void __user *dst, const void *src,
unsigned long len) unsigned long len)
{ {
mtsp(get_kernel_space(), 1); mtsp(get_kernel_space(), 1);
mtsp(get_user_space(), 2); mtsp(get_user_space(), 2);
return pa_memcpy((void __force *)dst, src, len); return pa_memcpy((void __force *)dst, src, len);
} }
EXPORT_SYMBOL(__copy_to_user); EXPORT_SYMBOL(raw_copy_to_user);
unsigned long __copy_from_user(void *dst, const void __user *src, unsigned long raw_copy_from_user(void *dst, const void __user *src,
unsigned long len) unsigned long len)
{ {
mtsp(get_user_space(), 1); mtsp(get_user_space(), 1);
mtsp(get_kernel_space(), 2); mtsp(get_kernel_space(), 2);
return pa_memcpy(dst, (void __force *)src, len); return pa_memcpy(dst, (void __force *)src, len);
} }
EXPORT_SYMBOL(__copy_from_user); EXPORT_SYMBOL(raw_copy_from_user);
unsigned long copy_in_user(void __user *dst, const void __user *src, unsigned long len) unsigned long raw_copy_in_user(void __user *dst, const void __user *src, unsigned long len)
{ {
mtsp(get_user_space(), 1); mtsp(get_user_space(), 1);
mtsp(get_user_space(), 2); mtsp(get_user_space(), 2);
...@@ -70,7 +70,7 @@ void * memcpy(void * dst,const void *src, size_t count) ...@@ -70,7 +70,7 @@ void * memcpy(void * dst,const void *src, size_t count)
return dst; return dst;
} }
EXPORT_SYMBOL(copy_in_user); EXPORT_SYMBOL(raw_copy_in_user);
EXPORT_SYMBOL(memcpy); EXPORT_SYMBOL(memcpy);
long probe_kernel_read(void *dst, const void *src, size_t size) long probe_kernel_read(void *dst, const void *src, size_t size)
......
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