diff options
author | Al Viro <viro@ftp.linux.org.uk> | 2005-09-26 01:19:28 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-26 21:29:50 -0400 |
commit | a880948b2b88c05af9a471ca5c52883e64d3f7b8 (patch) | |
tree | d4329f5c54a7bd7e57699a8c194446109a6f6047 | |
parent | c74dbac71419cdeaca8cd637ee666d6947961695 (diff) |
[PATCH] m32r: more basic __user annotations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | arch/m32r/lib/usercopy.c | 16 | ||||
-rw-r--r-- | include/asm-m32r/uaccess.h | 10 |
2 files changed, 14 insertions, 12 deletions
diff --git a/arch/m32r/lib/usercopy.c b/arch/m32r/lib/usercopy.c index 6c6855f1aa05..ce16bbe26a52 100644 --- a/arch/m32r/lib/usercopy.c +++ b/arch/m32r/lib/usercopy.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include <asm/uaccess.h> | 13 | #include <asm/uaccess.h> |
14 | 14 | ||
15 | unsigned long | 15 | unsigned long |
16 | __generic_copy_to_user(void *to, const void *from, unsigned long n) | 16 | __generic_copy_to_user(void __user *to, const void *from, unsigned long n) |
17 | { | 17 | { |
18 | prefetch(from); | 18 | prefetch(from); |
19 | if (access_ok(VERIFY_WRITE, to, n)) | 19 | if (access_ok(VERIFY_WRITE, to, n)) |
@@ -22,7 +22,7 @@ __generic_copy_to_user(void *to, const void *from, unsigned long n) | |||
22 | } | 22 | } |
23 | 23 | ||
24 | unsigned long | 24 | unsigned long |
25 | __generic_copy_from_user(void *to, const void *from, unsigned long n) | 25 | __generic_copy_from_user(void *to, const void __user *from, unsigned long n) |
26 | { | 26 | { |
27 | prefetchw(to); | 27 | prefetchw(to); |
28 | if (access_ok(VERIFY_READ, from, n)) | 28 | if (access_ok(VERIFY_READ, from, n)) |
@@ -111,7 +111,7 @@ do { \ | |||
111 | #endif /* CONFIG_ISA_DUAL_ISSUE */ | 111 | #endif /* CONFIG_ISA_DUAL_ISSUE */ |
112 | 112 | ||
113 | long | 113 | long |
114 | __strncpy_from_user(char *dst, const char *src, long count) | 114 | __strncpy_from_user(char *dst, const char __user *src, long count) |
115 | { | 115 | { |
116 | long res; | 116 | long res; |
117 | __do_strncpy_from_user(dst, src, count, res); | 117 | __do_strncpy_from_user(dst, src, count, res); |
@@ -119,7 +119,7 @@ __strncpy_from_user(char *dst, const char *src, long count) | |||
119 | } | 119 | } |
120 | 120 | ||
121 | long | 121 | long |
122 | strncpy_from_user(char *dst, const char *src, long count) | 122 | strncpy_from_user(char *dst, const char __user *src, long count) |
123 | { | 123 | { |
124 | long res = -EFAULT; | 124 | long res = -EFAULT; |
125 | if (access_ok(VERIFY_READ, src, 1)) | 125 | if (access_ok(VERIFY_READ, src, 1)) |
@@ -222,7 +222,7 @@ do { \ | |||
222 | #endif /* not CONFIG_ISA_DUAL_ISSUE */ | 222 | #endif /* not CONFIG_ISA_DUAL_ISSUE */ |
223 | 223 | ||
224 | unsigned long | 224 | unsigned long |
225 | clear_user(void *to, unsigned long n) | 225 | clear_user(void __user *to, unsigned long n) |
226 | { | 226 | { |
227 | if (access_ok(VERIFY_WRITE, to, n)) | 227 | if (access_ok(VERIFY_WRITE, to, n)) |
228 | __do_clear_user(to, n); | 228 | __do_clear_user(to, n); |
@@ -230,7 +230,7 @@ clear_user(void *to, unsigned long n) | |||
230 | } | 230 | } |
231 | 231 | ||
232 | unsigned long | 232 | unsigned long |
233 | __clear_user(void *to, unsigned long n) | 233 | __clear_user(void __user *to, unsigned long n) |
234 | { | 234 | { |
235 | __do_clear_user(to, n); | 235 | __do_clear_user(to, n); |
236 | return n; | 236 | return n; |
@@ -244,7 +244,7 @@ __clear_user(void *to, unsigned long n) | |||
244 | 244 | ||
245 | #ifdef CONFIG_ISA_DUAL_ISSUE | 245 | #ifdef CONFIG_ISA_DUAL_ISSUE |
246 | 246 | ||
247 | long strnlen_user(const char *s, long n) | 247 | long strnlen_user(const char __user *s, long n) |
248 | { | 248 | { |
249 | unsigned long mask = -__addr_ok(s); | 249 | unsigned long mask = -__addr_ok(s); |
250 | unsigned long res; | 250 | unsigned long res; |
@@ -313,7 +313,7 @@ long strnlen_user(const char *s, long n) | |||
313 | 313 | ||
314 | #else /* not CONFIG_ISA_DUAL_ISSUE */ | 314 | #else /* not CONFIG_ISA_DUAL_ISSUE */ |
315 | 315 | ||
316 | long strnlen_user(const char *s, long n) | 316 | long strnlen_user(const char __user *s, long n) |
317 | { | 317 | { |
318 | unsigned long mask = -__addr_ok(s); | 318 | unsigned long mask = -__addr_ok(s); |
319 | unsigned long res; | 319 | unsigned long res; |
diff --git a/include/asm-m32r/uaccess.h b/include/asm-m32r/uaccess.h index 93d863c455a1..0da7c47d2f01 100644 --- a/include/asm-m32r/uaccess.h +++ b/include/asm-m32r/uaccess.h | |||
@@ -208,7 +208,8 @@ extern void __get_user_4(void); | |||
208 | * On error, the variable @x is set to zero. | 208 | * On error, the variable @x is set to zero. |
209 | */ | 209 | */ |
210 | #define get_user(x,ptr) \ | 210 | #define get_user(x,ptr) \ |
211 | ({ int __ret_gu,__val_gu; \ | 211 | ({ int __ret_gu; \ |
212 | unsigned long __val_gu; \ | ||
212 | __chk_user_ptr(ptr); \ | 213 | __chk_user_ptr(ptr); \ |
213 | switch(sizeof (*(ptr))) { \ | 214 | switch(sizeof (*(ptr))) { \ |
214 | case 1: __get_user_x(1,__ret_gu,__val_gu,ptr); break; \ | 215 | case 1: __get_user_x(1,__ret_gu,__val_gu,ptr); break; \ |
@@ -403,7 +404,8 @@ struct __large_struct { unsigned long buf[100]; }; | |||
403 | 404 | ||
404 | #define __get_user_nocheck(x,ptr,size) \ | 405 | #define __get_user_nocheck(x,ptr,size) \ |
405 | ({ \ | 406 | ({ \ |
406 | long __gu_err, __gu_val; \ | 407 | long __gu_err; \ |
408 | unsigned long __gu_val; \ | ||
407 | __get_user_size(__gu_val,(ptr),(size),__gu_err); \ | 409 | __get_user_size(__gu_val,(ptr),(size),__gu_err); \ |
408 | (x) = (__typeof__(*(ptr)))__gu_val; \ | 410 | (x) = (__typeof__(*(ptr)))__gu_val; \ |
409 | __gu_err; \ | 411 | __gu_err; \ |
@@ -594,8 +596,8 @@ static inline unsigned long __generic_copy_to_user_nocheck(void __user *to, | |||
594 | return n; | 596 | return n; |
595 | } | 597 | } |
596 | 598 | ||
597 | unsigned long __generic_copy_to_user(void *, const void *, unsigned long); | 599 | unsigned long __generic_copy_to_user(void __user *, const void *, unsigned long); |
598 | unsigned long __generic_copy_from_user(void *, const void *, unsigned long); | 600 | unsigned long __generic_copy_from_user(void *, const void __user *, unsigned long); |
599 | 601 | ||
600 | /** | 602 | /** |
601 | * __copy_to_user: - Copy a block of data into user space, with less checking. | 603 | * __copy_to_user: - Copy a block of data into user space, with less checking. |