Commit cab6869d authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] uaccess.h annotations

the usual - __iomem in definition of __mm() on several platforms that
haven't got it by now, s/long/unsigned long/ for __gu_val in get_user(),
__force on places where we pass pointers to low-level __user-agnostic
primitive (__copy_tofrom_user() and its ilk).
Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.theplanet.co.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 92f60ed8
......@@ -91,7 +91,8 @@ extern void __get_user_unknown(void);
#define __get_user_nocheck(x,ptr,size) \
({ \
long __gu_err = 0, __gu_val; \
long __gu_err = 0; \
unsigned long __gu_val; \
__chk_user_ptr(ptr); \
switch (size) { \
case 1: __get_user_8(ptr); break; \
......@@ -106,7 +107,8 @@ extern void __get_user_unknown(void);
#define __get_user_check(x,ptr,size,segment) \
({ \
long __gu_err = -EFAULT, __gu_val = 0; \
long __gu_err = -EFAULT; \
unsigned long __gu_val = 0; \
const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
if (__access_ok((unsigned long)__gu_addr,size,segment)) { \
__gu_err = 0; \
......@@ -123,7 +125,7 @@ extern void __get_user_unknown(void);
})
struct __large_struct { unsigned long buf[100]; };
#define __m(x) (*(struct __large_struct *)(x))
#define __m(x) (*(struct __large_struct __user *)(x))
#define __get_user_64(addr) \
__asm__("1: ldq %0,%2\n" \
......
......@@ -244,7 +244,7 @@ __copy_from_user(void *to, const void __user *from, unsigned long n)
return ret;
}
}
return __copy_tofrom_user((void __user *) to, from, n);
return __copy_tofrom_user((__force void __user *) to, from, n);
}
static inline unsigned long
......@@ -269,7 +269,7 @@ __copy_to_user(void __user *to, const void *from, unsigned long n)
return ret;
}
}
return __copy_tofrom_user(to, (const void __user *) from, n);
return __copy_tofrom_user(to, (__force const void __user *) from, n);
}
#define __copy_in_user(to, from, size) \
......
......@@ -111,7 +111,7 @@ __get_user_check((x),__gu_addr,sizeof(*(ptr)),__typeof__(*(ptr))); })
#define __get_user(x,ptr) __get_user_nocheck((x),(ptr),sizeof(*(ptr)),__typeof__(*(ptr)))
struct __large_struct { unsigned long buf[100]; };
#define __m(x) ((struct __large_struct *)(x))
#define __m(x) ((struct __large_struct __user *)(x))
#define __put_user_check(x,addr,size) ({ \
register int __pu_ret; \
......@@ -299,27 +299,27 @@ extern unsigned long __copy_user(void __user *to, const void __user *from, unsig
static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n)
{
if (n && __access_ok((unsigned long) to, n))
return __copy_user(to, (void __user *) from, n);
return __copy_user(to, (__force void __user *) from, n);
else
return n;
}
static inline unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n)
{
return __copy_user(to, (void __user *) from, n);
return __copy_user(to, (__force void __user *) from, n);
}
static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n)
{
if (n && __access_ok((unsigned long) from, n))
return __copy_user((void __user *) to, from, n);
return __copy_user((__force void __user *) to, from, n);
else
return n;
}
static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n)
{
return __copy_user((void __user *) to, from, n);
return __copy_user((__force void __user *) to, from, n);
}
#define __copy_to_user_inatomic __copy_to_user
......
......@@ -198,7 +198,7 @@ struct __large_struct { unsigned long buf[100]; };
#define __get_user_nocheck(x,ptr,size) \
({ \
int __gu_err; \
long __gu_val; \
unsigned long __gu_val; \
__get_user_size(__gu_val,(ptr),(size),__gu_err); \
(x) = (__typeof__(*(ptr)))__gu_val; \
__gu_err; \
......
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