diff options
-rw-r--r-- | arch/x86_64/ia32/ptrace32.c | 6 | ||||
-rw-r--r-- | include/asm-x86_64/i387.h | 4 | ||||
-rw-r--r-- | include/asm-x86_64/uaccess.h | 46 |
3 files changed, 33 insertions, 23 deletions
diff --git a/arch/x86_64/ia32/ptrace32.c b/arch/x86_64/ia32/ptrace32.c index 72bf92a9d375..d18198ed636b 100644 --- a/arch/x86_64/ia32/ptrace32.c +++ b/arch/x86_64/ia32/ptrace32.c | |||
@@ -375,8 +375,10 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data) | |||
375 | ret = -EIO; | 375 | ret = -EIO; |
376 | if (!access_ok(VERIFY_READ, u, sizeof(*u))) | 376 | if (!access_ok(VERIFY_READ, u, sizeof(*u))) |
377 | break; | 377 | break; |
378 | /* no checking to be bug-to-bug compatible with i386 */ | 378 | /* no checking to be bug-to-bug compatible with i386. */ |
379 | __copy_from_user(&child->thread.i387.fxsave, u, sizeof(*u)); | 379 | /* but silence warning */ |
380 | if (__copy_from_user(&child->thread.i387.fxsave, u, sizeof(*u))) | ||
381 | ; | ||
380 | set_stopped_child_used_math(child); | 382 | set_stopped_child_used_math(child); |
381 | child->thread.i387.fxsave.mxcsr &= mxcsr_feature_mask; | 383 | child->thread.i387.fxsave.mxcsr &= mxcsr_feature_mask; |
382 | ret = 0; | 384 | ret = 0; |
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 */ |
240 | extern unsigned long copy_user_generic(void *to, const void *from, unsigned len); | 240 | __must_check unsigned long |
241 | extern unsigned long copy_user_generic_dontzero(void *to, const void *from, unsigned len); | 241 | copy_user_generic(void *to, const void *from, unsigned len); |
242 | 242 | ||
243 | extern unsigned long copy_to_user(void __user *to, const void *from, unsigned len); | 243 | __must_check unsigned long |
244 | extern unsigned long copy_from_user(void *to, const void __user *from, unsigned len); | 244 | copy_to_user(void __user *to, const void *from, unsigned len); |
245 | extern unsigned long copy_in_user(void __user *to, const void __user *from, unsigned len); | 245 | __must_check unsigned long |
246 | 246 | copy_from_user(void *to, const void __user *from, unsigned len); | |
247 | static __always_inline int __copy_from_user(void *dst, const void __user *src, unsigned size) | 247 | __must_check unsigned long |
248 | copy_in_user(void __user *to, const void __user *from, unsigned len); | ||
249 | |||
250 | static __always_inline __must_check | ||
251 | int __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 | ||
276 | static __always_inline int __copy_to_user(void __user *dst, const void *src, unsigned size) | 280 | static __always_inline __must_check |
281 | int __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 | ||
307 | static __always_inline int __copy_in_user(void __user *dst, const void __user *src, unsigned size) | 312 | static __always_inline __must_check |
313 | int __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 | ||
347 | long strncpy_from_user(char *dst, const char __user *src, long count); | 353 | __must_check long |
348 | long __strncpy_from_user(char *dst, const char __user *src, long count); | 354 | strncpy_from_user(char *dst, const char __user *src, long count); |
349 | long strnlen_user(const char __user *str, long n); | 355 | __must_check long |
350 | long __strnlen_user(const char __user *str, long n); | 356 | __strncpy_from_user(char *dst, const char __user *src, long count); |
351 | long strlen_user(const char __user *str); | 357 | __must_check long strnlen_user(const char __user *str, long n); |
352 | unsigned long clear_user(void __user *mem, unsigned long len); | 358 | __must_check long __strnlen_user(const char __user *str, long n); |
353 | unsigned 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); | |
355 | extern 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 */ |