Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1495240
| From | Johannes Berg <johannes@sipsolutions.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] x86: suppress sparse warning in copy_to_user() |
| Date | 2016-10-04 09:40 +0200 |
| Message-ID | <sosut-7Z7-7@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
From: Johannes Berg <johannes.berg@intel.com>
__compiletime_object_size() is simply defined to __builtin_object_size()
which gcc declares with (void *, int type) prototype. This is also done
by sparse, since it follows gcc, which leads it to warn, many times, on
any usage of copy_to_user(), about it:
arch/x86/include/asm/uaccess.h:735:18: warning: incorrect type in argument 1 (different modifiers)
arch/x86/include/asm/uaccess.h:735:18: expected void *<noident>
arch/x86/include/asm/uaccess.h:735:18: got void const *from
Suppress this by adding a (void *) cast. The compiler probably should
have declared it as const, but as it doesn't this is necessary. If it
changes, then the cast also won't matter.
Fixes: 7a3d9b0f3abbe ("x86: Unify copy_to_user() and add size checking to it")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
arch/x86/include/asm/uaccess.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
index 2131c4ce7d8a..0bd4a5a86199 100644
--- a/arch/x86/include/asm/uaccess.h
+++ b/arch/x86/include/asm/uaccess.h
@@ -732,7 +732,7 @@ copy_from_user(void *to, const void __user *from, unsigned long n)
static __always_inline unsigned long __must_check
copy_to_user(void __user *to, const void *from, unsigned long n)
{
- int sz = __compiletime_object_size(from);
+ int sz = __compiletime_object_size((void *)from);
kasan_check_read(from, n);
--
2.8.1
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] x86: suppress sparse warning in copy_to_user() Johannes Berg <johannes@sipsolutions.net> - 2016-10-04 09:40 +0200
Re: [PATCH] x86: suppress sparse warning in copy_to_user() "Jan Beulich" <JBeulich@suse.com> - 2016-10-04 10:00 +0200
Re: [PATCH] x86: suppress sparse warning in copy_to_user() Johannes Berg <johannes@sipsolutions.net> - 2016-10-04 10:10 +0200
Re: [PATCH] x86: suppress sparse warning in copy_to_user() "Jan Beulich" <JBeulich@suse.com> - 2016-10-04 10:40 +0200
Re: [PATCH] x86: suppress sparse warning in copy_to_user() Johannes Berg <johannes@sipsolutions.net> - 2016-10-04 10:50 +0200
Re: [PATCH] x86: suppress sparse warning in copy_to_user() "Jan Beulich" <JBeulich@suse.com> - 2016-10-04 11:10 +0200
csiph-web