sh: Fix get_user()/put_user() build error.
Fixes the build error caused by -Werror on gcc 3.x compilers: arch/sh/kernel/signal_32.c: In function `sys_sigaction': arch/sh/kernel/signal_32.c:66: warning: initialization discards qualifiers from pointer target type arch/sh/kernel/signal_32.c:67: warning: initialization discards qualifiers from pointer target type arch/sh/kernel/signal_32.c:69: warning: initialization discards qualifiers from pointer target type arch/sh/kernel/signal_32.c:70: warning: initialization discards qualifiers from pointer target type The mismatch in question was introduced by commit-id 9c5a4eec79b3eb8876d2e7fddfa1e040a7650e55. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
parent
31a49c4bf8
commit
0465b9fb5f
|
@ -95,11 +95,9 @@ static inline int __access_ok(unsigned long addr, unsigned long size)
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_MMU */
|
#endif /* CONFIG_MMU */
|
||||||
|
|
||||||
static inline int access_ok(int type, const void __user *p, unsigned long size)
|
#define access_ok(type, addr, size) \
|
||||||
{
|
(__chk_user_ptr(addr), \
|
||||||
unsigned long addr = (unsigned long)p;
|
__access_ok((unsigned long __force)(addr), (size)))
|
||||||
return __access_ok(addr, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Uh, these should become the main single-value transfer routines ...
|
* Uh, these should become the main single-value transfer routines ...
|
||||||
|
@ -113,18 +111,16 @@ static inline int access_ok(int type, const void __user *p, unsigned long size)
|
||||||
* (a) re-use the arguments for side effects (sizeof is ok)
|
* (a) re-use the arguments for side effects (sizeof is ok)
|
||||||
* (b) require any knowledge of processes at this stage
|
* (b) require any knowledge of processes at this stage
|
||||||
*/
|
*/
|
||||||
#define put_user(x,ptr) __put_user_check((x),(ptr),sizeof(*(ptr)))
|
#define put_user(x,ptr) __put_user_check((x), (ptr), sizeof(*(ptr)))
|
||||||
#define get_user(x,ptr) __get_user_check((x),(ptr),sizeof(*(ptr)))
|
#define get_user(x,ptr) __get_user_check((x), (ptr), sizeof(*(ptr)))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The "__xxx" versions do not do address space checking, useful when
|
* The "__xxx" versions do not do address space checking, useful when
|
||||||
* doing multiple accesses to the same area (the user has to do the
|
* doing multiple accesses to the same area (the user has to do the
|
||||||
* checks by hand with "access_ok()")
|
* checks by hand with "access_ok()")
|
||||||
*/
|
*/
|
||||||
#define __put_user(x,ptr) \
|
#define __put_user(x,ptr) __put_user_nocheck((x), (ptr), sizeof(*(ptr)))
|
||||||
__put_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
|
#define __get_user(x,ptr) __get_user_nocheck((x), (ptr), sizeof(*(ptr)))
|
||||||
#define __get_user(x,ptr) \
|
|
||||||
__get_user_nocheck((x),(ptr),sizeof(*(ptr)))
|
|
||||||
|
|
||||||
struct __large_struct { unsigned long buf[100]; };
|
struct __large_struct { unsigned long buf[100]; };
|
||||||
#define __m(x) (*(struct __large_struct __user *)(x))
|
#define __m(x) (*(struct __large_struct __user *)(x))
|
||||||
|
@ -132,7 +128,6 @@ struct __large_struct { unsigned long buf[100]; };
|
||||||
#define __get_user_size(x,ptr,size,retval) \
|
#define __get_user_size(x,ptr,size,retval) \
|
||||||
do { \
|
do { \
|
||||||
retval = 0; \
|
retval = 0; \
|
||||||
__chk_user_ptr(ptr); \
|
|
||||||
switch (size) { \
|
switch (size) { \
|
||||||
case 1: \
|
case 1: \
|
||||||
__get_user_asm(x, ptr, retval, "b"); \
|
__get_user_asm(x, ptr, retval, "b"); \
|
||||||
|
@ -151,24 +146,22 @@ do { \
|
||||||
|
|
||||||
#define __get_user_nocheck(x,ptr,size) \
|
#define __get_user_nocheck(x,ptr,size) \
|
||||||
({ \
|
({ \
|
||||||
long __gu_err, __gu_val; \
|
long __gu_err; \
|
||||||
__typeof__(*(ptr)) *__pu_addr = (ptr); \
|
unsigned long __gu_val; \
|
||||||
__get_user_size(__gu_val, (__pu_addr), (size), __gu_err); \
|
const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
|
||||||
|
__chk_user_ptr(ptr); \
|
||||||
|
__get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
|
||||||
(x) = (__typeof__(*(ptr)))__gu_val; \
|
(x) = (__typeof__(*(ptr)))__gu_val; \
|
||||||
__gu_err; \
|
__gu_err; \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define __get_user_check(x,ptr,size) \
|
#define __get_user_check(x,ptr,size) \
|
||||||
({ \
|
({ \
|
||||||
long __gu_err, __gu_val; \
|
long __gu_err = -EFAULT; \
|
||||||
__typeof__(*(ptr)) *__pu_addr = (ptr); \
|
unsigned long __gu_val = 0; \
|
||||||
__chk_user_ptr(__pu_addr); \
|
const __typeof__(*(ptr)) *__gu_addr = (ptr); \
|
||||||
if (likely(__addr_ok((unsigned long)(__pu_addr)))) { \
|
if (likely(access_ok(VERIFY_READ, __gu_addr, (size)))) \
|
||||||
__get_user_size(__gu_val, (__pu_addr), (size), __gu_err);\
|
__get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
|
||||||
} else { \
|
|
||||||
__gu_err = -EFAULT; \
|
|
||||||
__gu_val = 0; \
|
|
||||||
} \
|
|
||||||
(x) = (__typeof__(*(ptr)))__gu_val; \
|
(x) = (__typeof__(*(ptr)))__gu_val; \
|
||||||
__gu_err; \
|
__gu_err; \
|
||||||
})
|
})
|
||||||
|
@ -199,7 +192,6 @@ extern void __get_user_unknown(void);
|
||||||
#define __put_user_size(x,ptr,size,retval) \
|
#define __put_user_size(x,ptr,size,retval) \
|
||||||
do { \
|
do { \
|
||||||
retval = 0; \
|
retval = 0; \
|
||||||
__chk_user_ptr(ptr); \
|
|
||||||
switch (size) { \
|
switch (size) { \
|
||||||
case 1: \
|
case 1: \
|
||||||
__put_user_asm(x, ptr, retval, "b"); \
|
__put_user_asm(x, ptr, retval, "b"); \
|
||||||
|
@ -218,22 +210,22 @@ do { \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define __put_user_nocheck(x,ptr,size) \
|
#define __put_user_nocheck(x,ptr,size) \
|
||||||
({ \
|
({ \
|
||||||
long __pu_err; \
|
long __pu_err; \
|
||||||
__put_user_size((x),(ptr),(size),__pu_err); \
|
__typeof__(*(ptr)) __user *__pu_addr = (ptr); \
|
||||||
__pu_err; \
|
__chk_user_ptr(ptr); \
|
||||||
|
__put_user_size((x), __pu_addr, (size), __pu_err); \
|
||||||
|
__pu_err; \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define __put_user_check(x,ptr,size) \
|
#define __put_user_check(x,ptr,size) \
|
||||||
({ \
|
({ \
|
||||||
long __pu_err; \
|
long __pu_err = -EFAULT; \
|
||||||
__typeof__(*(ptr)) __user *__pu_addr = (ptr); \
|
__typeof__(*(ptr)) __user *__pu_addr = (ptr); \
|
||||||
\
|
if (likely(access_ok(VERIFY_WRITE, __pu_addr, size))) \
|
||||||
if (likely(__addr_ok((unsigned long)__pu_addr))) \
|
__put_user_size((x), __pu_addr, (size), \
|
||||||
__put_user_size((x),__pu_addr,(size),__pu_err); \
|
__pu_err); \
|
||||||
else \
|
|
||||||
__pu_err = -EFAULT; \
|
|
||||||
__pu_err; \
|
__pu_err; \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue