[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1475566428-22484-1-git-send-email-johannes@sipsolutions.net>
Date: Tue, 4 Oct 2016 09:33:48 +0200
From: Johannes Berg <johannes@...solutions.net>
To: x86@...nel.org
Cc: Jan Beulich <JBeulich@...e.com>, Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
"H. Peter Anvin" <hpa@...or.com>, linux-kernel@...r.kernel.org,
Johannes Berg <johannes.berg@...el.com>
Subject: [PATCH] x86: suppress sparse warning in copy_to_user()
From: Johannes Berg <johannes.berg@...el.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@...el.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
Powered by blists - more mailing lists