Commit 64ed7893 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: __forced added to casts in arch-specific code

	Casts from __user to address-space-agnostic in amd64 and i386
made explicit (__force added; in these places we pass userland pointer
to arch-specific code that handles kernel and userland pointers the
same way).
	csum_partial_copy_*() annotated properly
parent 524f2677
...@@ -43,7 +43,7 @@ csum_partial_copy_from_user(const char __user *src, char *dst, ...@@ -43,7 +43,7 @@ csum_partial_copy_from_user(const char __user *src, char *dst,
len -= 2; len -= 2;
} }
} }
isum = csum_partial_copy_generic((void *)src,dst,len,isum,errp,NULL); isum = csum_partial_copy_generic((__force void *)src,dst,len,isum,errp,NULL);
if (likely(*errp == 0)) if (likely(*errp == 0))
return isum; return isum;
} }
...@@ -88,7 +88,7 @@ csum_partial_copy_to_user(const char *src, char __user *dst, ...@@ -88,7 +88,7 @@ csum_partial_copy_to_user(const char *src, char __user *dst,
} }
*errp = 0; *errp = 0;
return csum_partial_copy_generic(src, (void *)dst,len,isum,NULL,errp); return csum_partial_copy_generic(src, (void __force *)dst,len,isum,NULL,errp);
} }
EXPORT_SYMBOL(csum_partial_copy_to_user); EXPORT_SYMBOL(csum_partial_copy_to_user);
......
...@@ -145,7 +145,7 @@ long strlen_user(const char __user *s) ...@@ -145,7 +145,7 @@ long strlen_user(const char __user *s)
unsigned long copy_in_user(void __user *to, const void __user *from, unsigned len) unsigned long copy_in_user(void __user *to, const void __user *from, unsigned len)
{ {
if (access_ok(VERIFY_WRITE, to, len) && access_ok(VERIFY_READ, from, len)) { if (access_ok(VERIFY_WRITE, to, len) && access_ok(VERIFY_READ, from, len)) {
return copy_user_generic((void *)to, (void *)from, len); return copy_user_generic((__force void *)to, (__force void *)from, len);
} }
return len; return len;
} }
...@@ -43,10 +43,10 @@ unsigned int csum_partial_copy_nocheck ( const char *src, char *dst, ...@@ -43,10 +43,10 @@ unsigned int csum_partial_copy_nocheck ( const char *src, char *dst,
} }
static __inline__ static __inline__
unsigned int csum_partial_copy_from_user ( const char *src, char *dst, unsigned int csum_partial_copy_from_user ( const char __user *src, char *dst,
int len, int sum, int *err_ptr) int len, int sum, int *err_ptr)
{ {
return csum_partial_copy_generic ( src, dst, len, sum, err_ptr, NULL); return csum_partial_copy_generic ( (__force char *)src, dst, len, sum, err_ptr, NULL);
} }
/* /*
...@@ -178,7 +178,7 @@ static __inline__ unsigned int csum_and_copy_to_user(const char *src, ...@@ -178,7 +178,7 @@ static __inline__ unsigned int csum_and_copy_to_user(const char *src,
int *err_ptr) int *err_ptr)
{ {
if (access_ok(VERIFY_WRITE, dst, len)) if (access_ok(VERIFY_WRITE, dst, len))
return csum_partial_copy_generic(src, dst, len, sum, NULL, err_ptr); return csum_partial_copy_generic(src, (__force char *)dst, len, sum, NULL, err_ptr);
if (len) if (len)
*err_ptr = -EFAULT; *err_ptr = -EFAULT;
......
...@@ -138,7 +138,7 @@ static inline void save_init_fpu( struct task_struct *tsk ) ...@@ -138,7 +138,7 @@ static inline void save_init_fpu( struct task_struct *tsk )
*/ */
static inline int restore_i387(struct _fpstate __user *buf) static inline int restore_i387(struct _fpstate __user *buf)
{ {
return restore_fpu_checking((struct i387_fxsave_struct *)buf); return restore_fpu_checking((__force struct i387_fxsave_struct *)buf);
} }
#endif /* __ASM_X86_64_I387_H */ #endif /* __ASM_X86_64_I387_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment