提交 a880948b 编写于 作者: A Al Viro 提交者: Linus Torvalds

[PATCH] m32r: more basic __user annotations

Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 c74dbac7
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
unsigned long unsigned long
__generic_copy_to_user(void *to, const void *from, unsigned long n) __generic_copy_to_user(void __user *to, const void *from, unsigned long n)
{ {
prefetch(from); prefetch(from);
if (access_ok(VERIFY_WRITE, to, n)) if (access_ok(VERIFY_WRITE, to, n))
...@@ -22,7 +22,7 @@ __generic_copy_to_user(void *to, const void *from, unsigned long n) ...@@ -22,7 +22,7 @@ __generic_copy_to_user(void *to, const void *from, unsigned long n)
} }
unsigned long unsigned long
__generic_copy_from_user(void *to, const void *from, unsigned long n) __generic_copy_from_user(void *to, const void __user *from, unsigned long n)
{ {
prefetchw(to); prefetchw(to);
if (access_ok(VERIFY_READ, from, n)) if (access_ok(VERIFY_READ, from, n))
...@@ -111,7 +111,7 @@ do { \ ...@@ -111,7 +111,7 @@ do { \
#endif /* CONFIG_ISA_DUAL_ISSUE */ #endif /* CONFIG_ISA_DUAL_ISSUE */
long long
__strncpy_from_user(char *dst, const char *src, long count) __strncpy_from_user(char *dst, const char __user *src, long count)
{ {
long res; long res;
__do_strncpy_from_user(dst, src, count, res); __do_strncpy_from_user(dst, src, count, res);
...@@ -119,7 +119,7 @@ __strncpy_from_user(char *dst, const char *src, long count) ...@@ -119,7 +119,7 @@ __strncpy_from_user(char *dst, const char *src, long count)
} }
long long
strncpy_from_user(char *dst, const char *src, long count) strncpy_from_user(char *dst, const char __user *src, long count)
{ {
long res = -EFAULT; long res = -EFAULT;
if (access_ok(VERIFY_READ, src, 1)) if (access_ok(VERIFY_READ, src, 1))
...@@ -222,7 +222,7 @@ do { \ ...@@ -222,7 +222,7 @@ do { \
#endif /* not CONFIG_ISA_DUAL_ISSUE */ #endif /* not CONFIG_ISA_DUAL_ISSUE */
unsigned long unsigned long
clear_user(void *to, unsigned long n) clear_user(void __user *to, unsigned long n)
{ {
if (access_ok(VERIFY_WRITE, to, n)) if (access_ok(VERIFY_WRITE, to, n))
__do_clear_user(to, n); __do_clear_user(to, n);
...@@ -230,7 +230,7 @@ clear_user(void *to, unsigned long n) ...@@ -230,7 +230,7 @@ clear_user(void *to, unsigned long n)
} }
unsigned long unsigned long
__clear_user(void *to, unsigned long n) __clear_user(void __user *to, unsigned long n)
{ {
__do_clear_user(to, n); __do_clear_user(to, n);
return n; return n;
...@@ -244,7 +244,7 @@ __clear_user(void *to, unsigned long n) ...@@ -244,7 +244,7 @@ __clear_user(void *to, unsigned long n)
#ifdef CONFIG_ISA_DUAL_ISSUE #ifdef CONFIG_ISA_DUAL_ISSUE
long strnlen_user(const char *s, long n) long strnlen_user(const char __user *s, long n)
{ {
unsigned long mask = -__addr_ok(s); unsigned long mask = -__addr_ok(s);
unsigned long res; unsigned long res;
...@@ -313,7 +313,7 @@ long strnlen_user(const char *s, long n) ...@@ -313,7 +313,7 @@ long strnlen_user(const char *s, long n)
#else /* not CONFIG_ISA_DUAL_ISSUE */ #else /* not CONFIG_ISA_DUAL_ISSUE */
long strnlen_user(const char *s, long n) long strnlen_user(const char __user *s, long n)
{ {
unsigned long mask = -__addr_ok(s); unsigned long mask = -__addr_ok(s);
unsigned long res; unsigned long res;
......
...@@ -208,7 +208,8 @@ extern void __get_user_4(void); ...@@ -208,7 +208,8 @@ extern void __get_user_4(void);
* On error, the variable @x is set to zero. * On error, the variable @x is set to zero.
*/ */
#define get_user(x,ptr) \ #define get_user(x,ptr) \
({ int __ret_gu,__val_gu; \ ({ int __ret_gu; \
unsigned long __val_gu; \
__chk_user_ptr(ptr); \ __chk_user_ptr(ptr); \
switch(sizeof (*(ptr))) { \ switch(sizeof (*(ptr))) { \
case 1: __get_user_x(1,__ret_gu,__val_gu,ptr); break; \ case 1: __get_user_x(1,__ret_gu,__val_gu,ptr); break; \
...@@ -403,7 +404,8 @@ struct __large_struct { unsigned long buf[100]; }; ...@@ -403,7 +404,8 @@ struct __large_struct { unsigned long buf[100]; };
#define __get_user_nocheck(x,ptr,size) \ #define __get_user_nocheck(x,ptr,size) \
({ \ ({ \
long __gu_err, __gu_val; \ long __gu_err; \
unsigned long __gu_val; \
__get_user_size(__gu_val,(ptr),(size),__gu_err); \ __get_user_size(__gu_val,(ptr),(size),__gu_err); \
(x) = (__typeof__(*(ptr)))__gu_val; \ (x) = (__typeof__(*(ptr)))__gu_val; \
__gu_err; \ __gu_err; \
...@@ -594,8 +596,8 @@ static inline unsigned long __generic_copy_to_user_nocheck(void __user *to, ...@@ -594,8 +596,8 @@ static inline unsigned long __generic_copy_to_user_nocheck(void __user *to,
return n; return n;
} }
unsigned long __generic_copy_to_user(void *, const void *, unsigned long); unsigned long __generic_copy_to_user(void __user *, const void *, unsigned long);
unsigned long __generic_copy_from_user(void *, const void *, unsigned long); unsigned long __generic_copy_from_user(void *, const void __user *, unsigned long);
/** /**
* __copy_to_user: - Copy a block of data into user space, with less checking. * __copy_to_user: - Copy a block of data into user space, with less checking.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册