aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2006-09-26 04:52:39 -0400
committerAndi Kleen <andi@basil.nowhere.org>2006-09-26 04:52:39 -0400
commit95912008ba1fb9d0677c1ce5930aeb0e85ba5710 (patch)
treee84c614f6aff984d105ce9f340f9474b613d567d /include
parent3022d734a54cbd2b65eea9a024564821101b4a9a (diff)
[PATCH] Add __must_check to copy_*_user
Following i386. And also fix the two occurrences that caused warnings in arch/x86_64/* Signed-off-by: Andi Kleen <ak@suse.de>
Diffstat (limited to 'include')
-rw-r--r--include/asm-x86_64/i387.h4
-rw-r--r--include/asm-x86_64/uaccess.h46
2 files changed, 29 insertions, 21 deletions
diff --git a/include/asm-x86_64/i387.h b/include/asm-x86_64/i387.h
index 60c0f4853fdb..0217b74cc9fc 100644
--- a/include/asm-x86_64/i387.h
+++ b/include/asm-x86_64/i387.h
@@ -137,8 +137,8 @@ static inline int save_i387_checking(struct i387_fxsave_struct __user *fx)
137#else 137#else
138 : [fx] "cdaSDb" (fx), "0" (0)); 138 : [fx] "cdaSDb" (fx), "0" (0));
139#endif 139#endif
140 if (unlikely(err)) 140 if (unlikely(err) && __clear_user(fx, sizeof(struct i387_fxsave_struct)))
141 __clear_user(fx, sizeof(struct i387_fxsave_struct)); 141 err = -EFAULT;
142 /* No need to clear here because the caller clears USED_MATH */ 142 /* No need to clear here because the caller clears USED_MATH */
143 return err; 143 return err;
144} 144}
diff --git a/include/asm-x86_64/uaccess.h b/include/asm-x86_64/uaccess.h
index bc6812009bd7..802a4a068ef6 100644
--- a/include/asm-x86_64/uaccess.h
+++ b/include/asm-x86_64/uaccess.h
@@ -237,14 +237,18 @@ do { \
237 */ 237 */
238 238
239/* Handles exceptions in both to and from, but doesn't do access_ok */ 239/* Handles exceptions in both to and from, but doesn't do access_ok */
240extern unsigned long copy_user_generic(void *to, const void *from, unsigned len); 240__must_check unsigned long
241extern unsigned long copy_user_generic_dontzero(void *to, const void *from, unsigned len); 241copy_user_generic(void *to, const void *from, unsigned len);
242 242
243extern unsigned long copy_to_user(void __user *to, const void *from, unsigned len); 243__must_check unsigned long
244extern unsigned long copy_from_user(void *to, const void __user *from, unsigned len); 244copy_to_user(void __user *to, const void *from, unsigned len);
245extern unsigned long copy_in_user(void __user *to, const void __user *from, unsigned len); 245__must_check unsigned long
246 246copy_from_user(void *to, const void __user *from, unsigned len);
247static __always_inline int __copy_from_user(void *dst, const void __user *src, unsigned size) 247__must_check unsigned long
248copy_in_user(void __user *to, const void __user *from, unsigned len);
249
250static __always_inline __must_check
251int __copy_from_user(void *dst, const void __user *src, unsigned size)
248{ 252{
249 int ret = 0; 253 int ret = 0;
250 if (!__builtin_constant_p(size)) 254 if (!__builtin_constant_p(size))
@@ -273,7 +277,8 @@ static __always_inline int __copy_from_user(void *dst, const void __user *src, u
273 } 277 }
274} 278}
275 279
276static __always_inline int __copy_to_user(void __user *dst, const void *src, unsigned size) 280static __always_inline __must_check
281int __copy_to_user(void __user *dst, const void *src, unsigned size)
277{ 282{
278 int ret = 0; 283 int ret = 0;
279 if (!__builtin_constant_p(size)) 284 if (!__builtin_constant_p(size))
@@ -304,7 +309,8 @@ static __always_inline int __copy_to_user(void __user *dst, const void *src, uns
304 } 309 }
305} 310}
306 311
307static __always_inline int __copy_in_user(void __user *dst, const void __user *src, unsigned size) 312static __always_inline __must_check
313int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
308{ 314{
309 int ret = 0; 315 int ret = 0;
310 if (!__builtin_constant_p(size)) 316 if (!__builtin_constant_p(size))
@@ -344,15 +350,17 @@ static __always_inline int __copy_in_user(void __user *dst, const void __user *s
344 } 350 }
345} 351}
346 352
347long strncpy_from_user(char *dst, const char __user *src, long count); 353__must_check long
348long __strncpy_from_user(char *dst, const char __user *src, long count); 354strncpy_from_user(char *dst, const char __user *src, long count);
349long strnlen_user(const char __user *str, long n); 355__must_check long
350long __strnlen_user(const char __user *str, long n); 356__strncpy_from_user(char *dst, const char __user *src, long count);
351long strlen_user(const char __user *str); 357__must_check long strnlen_user(const char __user *str, long n);
352unsigned long clear_user(void __user *mem, unsigned long len); 358__must_check long __strnlen_user(const char __user *str, long n);
353unsigned long __clear_user(void __user *mem, unsigned long len); 359__must_check long strlen_user(const char __user *str);
354 360__must_check unsigned long clear_user(void __user *mem, unsigned long len);
355extern long __copy_from_user_inatomic(void *dst, const void __user *src, unsigned size); 361__must_check unsigned long __clear_user(void __user *mem, unsigned long len);
362
363__must_check long __copy_from_user_inatomic(void *dst, const void __user *src, unsigned size);
356#define __copy_to_user_inatomic copy_user_generic 364#define __copy_to_user_inatomic copy_user_generic
357 365
358#endif /* __X86_64_UACCESS_H */ 366#endif /* __X86_64_UACCESS_H */