[PATCH] m68knommu: add missing __user annotations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some of the m68knommu user access functions are not using the __user
annotation where required. Specifically __clear_user(), strnlen_user()
and strncpy_from_user() need their user space source address annoted
with __user.

Picked up by the kernel test robot, when running sparse:

  sparse warnings: (new ones prefixed by >>)

     drivers/char/mem.c:163:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *to @@     got char [noderef] __user *buf @@
     drivers/char/mem.c:163:37: sparse:     expected void *to
     drivers/char/mem.c:163:37: sparse:     got char [noderef] __user *buf
  >> drivers/char/mem.c:737:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *to @@     got char [noderef] __user * @@
     drivers/char/mem.c:737:21: sparse:     expected void *to
  >> drivers/char/mem.c:737:21: sparse:     got char [noderef] __user *

Add in __user where appropriate.

Reported-by: kernel test robot <lkp@xxxxxxxxx>
Signed-off-by: Greg Ungerer <gerg@xxxxxxxxxxxxxx>
---
 arch/m68k/include/asm/uaccess_no.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/m68k/include/asm/uaccess_no.h b/arch/m68k/include/asm/uaccess_no.h
index dcfb69361408..764b01a3bd07 100644
--- a/arch/m68k/include/asm/uaccess_no.h
+++ b/arch/m68k/include/asm/uaccess_no.h
@@ -125,7 +125,7 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)
  */
 
 static inline long
-strncpy_from_user(char *dst, const char *src, long count)
+strncpy_from_user(char *dst, const char __user *src, long count)
 {
 	char *tmp;
 	strncpy(dst, src, count);
@@ -139,7 +139,7 @@ strncpy_from_user(char *dst, const char *src, long count)
  *
  * Return 0 on exception, a value greater than N if too long
  */
-static inline long strnlen_user(const char *src, long n)
+static inline long strnlen_user(const char __user *src, long n)
 {
 	return(strlen(src) + 1); /* DAVIDM make safer */
 }
@@ -149,7 +149,7 @@ static inline long strnlen_user(const char *src, long n)
  */
 
 static inline unsigned long
-__clear_user(void *to, unsigned long n)
+__clear_user(void __user *to, unsigned long n)
 {
 	memset(to, 0, n);
 	return 0;
-- 
2.25.1




[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux