mirror of
https://github.com/fail0verflow/switch-linux.git
synced 2025-05-04 02:34:21 -04:00
[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>
This commit is contained in:
parent
3022d734a5
commit
95912008ba
3 changed files with 30 additions and 20 deletions
|
@ -375,8 +375,10 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
if (!access_ok(VERIFY_READ, u, sizeof(*u)))
|
if (!access_ok(VERIFY_READ, u, sizeof(*u)))
|
||||||
break;
|
break;
|
||||||
/* no checking to be bug-to-bug compatible with i386 */
|
/* no checking to be bug-to-bug compatible with i386. */
|
||||||
__copy_from_user(&child->thread.i387.fxsave, u, sizeof(*u));
|
/* but silence warning */
|
||||||
|
if (__copy_from_user(&child->thread.i387.fxsave, u, sizeof(*u)))
|
||||||
|
;
|
||||||
set_stopped_child_used_math(child);
|
set_stopped_child_used_math(child);
|
||||||
child->thread.i387.fxsave.mxcsr &= mxcsr_feature_mask;
|
child->thread.i387.fxsave.mxcsr &= mxcsr_feature_mask;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
|
@ -137,8 +137,8 @@ static inline int save_i387_checking(struct i387_fxsave_struct __user *fx)
|
||||||
#else
|
#else
|
||||||
: [fx] "cdaSDb" (fx), "0" (0));
|
: [fx] "cdaSDb" (fx), "0" (0));
|
||||||
#endif
|
#endif
|
||||||
if (unlikely(err))
|
if (unlikely(err) && __clear_user(fx, sizeof(struct i387_fxsave_struct)))
|
||||||
__clear_user(fx, sizeof(struct i387_fxsave_struct));
|
err = -EFAULT;
|
||||||
/* No need to clear here because the caller clears USED_MATH */
|
/* No need to clear here because the caller clears USED_MATH */
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,14 +237,18 @@ do { \
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Handles exceptions in both to and from, but doesn't do access_ok */
|
/* Handles exceptions in both to and from, but doesn't do access_ok */
|
||||||
extern unsigned long copy_user_generic(void *to, const void *from, unsigned len);
|
__must_check unsigned long
|
||||||
extern unsigned long copy_user_generic_dontzero(void *to, const void *from, unsigned len);
|
copy_user_generic(void *to, const void *from, unsigned len);
|
||||||
|
|
||||||
extern unsigned long copy_to_user(void __user *to, const void *from, unsigned len);
|
__must_check unsigned long
|
||||||
extern unsigned long copy_from_user(void *to, const void __user *from, unsigned len);
|
copy_to_user(void __user *to, const void *from, unsigned len);
|
||||||
extern unsigned long copy_in_user(void __user *to, const void __user *from, unsigned len);
|
__must_check unsigned long
|
||||||
|
copy_from_user(void *to, const void __user *from, unsigned len);
|
||||||
|
__must_check unsigned long
|
||||||
|
copy_in_user(void __user *to, const void __user *from, unsigned len);
|
||||||
|
|
||||||
static __always_inline int __copy_from_user(void *dst, const void __user *src, unsigned size)
|
static __always_inline __must_check
|
||||||
|
int __copy_from_user(void *dst, const void __user *src, unsigned size)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
if (!__builtin_constant_p(size))
|
if (!__builtin_constant_p(size))
|
||||||
|
@ -273,7 +277,8 @@ static __always_inline int __copy_from_user(void *dst, const void __user *src, u
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static __always_inline int __copy_to_user(void __user *dst, const void *src, unsigned size)
|
static __always_inline __must_check
|
||||||
|
int __copy_to_user(void __user *dst, const void *src, unsigned size)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
if (!__builtin_constant_p(size))
|
if (!__builtin_constant_p(size))
|
||||||
|
@ -304,7 +309,8 @@ static __always_inline int __copy_to_user(void __user *dst, const void *src, uns
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static __always_inline int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
|
static __always_inline __must_check
|
||||||
|
int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
if (!__builtin_constant_p(size))
|
if (!__builtin_constant_p(size))
|
||||||
|
@ -344,15 +350,17 @@ static __always_inline int __copy_in_user(void __user *dst, const void __user *s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long strncpy_from_user(char *dst, const char __user *src, long count);
|
__must_check long
|
||||||
long __strncpy_from_user(char *dst, const char __user *src, long count);
|
strncpy_from_user(char *dst, const char __user *src, long count);
|
||||||
long strnlen_user(const char __user *str, long n);
|
__must_check long
|
||||||
long __strnlen_user(const char __user *str, long n);
|
__strncpy_from_user(char *dst, const char __user *src, long count);
|
||||||
long strlen_user(const char __user *str);
|
__must_check long strnlen_user(const char __user *str, long n);
|
||||||
unsigned long clear_user(void __user *mem, unsigned long len);
|
__must_check long __strnlen_user(const char __user *str, long n);
|
||||||
unsigned long __clear_user(void __user *mem, unsigned long len);
|
__must_check long strlen_user(const char __user *str);
|
||||||
|
__must_check unsigned long clear_user(void __user *mem, unsigned long len);
|
||||||
|
__must_check unsigned long __clear_user(void __user *mem, unsigned long len);
|
||||||
|
|
||||||
extern long __copy_from_user_inatomic(void *dst, const void __user *src, unsigned size);
|
__must_check long __copy_from_user_inatomic(void *dst, const void __user *src, unsigned size);
|
||||||
#define __copy_to_user_inatomic copy_user_generic
|
#define __copy_to_user_inatomic copy_user_generic
|
||||||
|
|
||||||
#endif /* __X86_64_UACCESS_H */
|
#endif /* __X86_64_UACCESS_H */
|
||||||
|
|
Loading…
Add table
Reference in a new issue