[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190228185027.2480-1-ben.dooks@codethink.co.uk>
Date: Thu, 28 Feb 2019 18:50:27 +0000
From: Ben Dooks <ben.dooks@...ethink.co.uk>
To: linux-kernel@...r.kernel.org
Cc: tglx@...utronix.de, mingo@...hat.co, bp@...en8.de, hpa@...or.com,
x86@...nel.org, linux-kernel@...ts.codethink.co.uk,
Ben Dooks <ben.dooks@...ethink.co.uk>
Subject: [PATCH] x86/asm: add __user on copy_user_handle_tail() pointers
The copy_user_handle_tail() clearly uses both from and to as pointers
to user-space memory. This triggers sparse warning on using the calls
to get and put to user-space. This can be fixed easily by changing the
call to take __user annotated pointer.s
arch/x86/lib/usercopy_64.c:68:21: warning: incorrect type in argument 1 (different address spaces)
arch/x86/lib/usercopy_64.c:68:21: expected void const volatile [noderef] <asn:1>*<noident>
arch/x86/lib/usercopy_64.c:68:21: got char *
arch/x86/lib/usercopy_64.c:70:21: warning: incorrect type in argument 1 (different address spaces)
arch/x86/lib/usercopy_64.c:70:21: expected void const volatile [noderef] <asn:1>*<noident>
arch/x86/lib/usercopy_64.c:70:21: got char *to
Signed-off-by: Ben Dooks <ben.dooks@...ethink.co.uk>
---
arch/x86/include/asm/uaccess_64.h | 2 +-
arch/x86/lib/usercopy_64.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/uaccess_64.h b/arch/x86/include/asm/uaccess_64.h
index a9d637bc301d..cbca2cb28939 100644
--- a/arch/x86/include/asm/uaccess_64.h
+++ b/arch/x86/include/asm/uaccess_64.h
@@ -208,7 +208,7 @@ __copy_from_user_flushcache(void *dst, const void __user *src, unsigned size)
}
unsigned long
-copy_user_handle_tail(char *to, char *from, unsigned len);
+copy_user_handle_tail(char __user *to, char __user *from, unsigned len);
unsigned long
mcsafe_handle_tail(char *to, char *from, unsigned len);
diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c
index ee42bb0cbeb3..aa180424e77a 100644
--- a/arch/x86/lib/usercopy_64.c
+++ b/arch/x86/lib/usercopy_64.c
@@ -60,7 +60,7 @@ EXPORT_SYMBOL(clear_user);
* it is not necessary to optimize tail handling.
*/
__visible unsigned long
-copy_user_handle_tail(char *to, char *from, unsigned len)
+copy_user_handle_tail(char __user *to, char __user *from, unsigned len)
{
for (; len; --len, to++) {
char c;
--
2.20.1
Powered by blists - more mailing lists