]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
m68k,nommu: fix implicit cast from __user in __{get,put}_user_asm()
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>
Fri, 29 May 2020 19:02:18 +0000 (21:02 +0200)
committerGreg Ungerer <gerg@linux-m68k.org>
Sat, 30 May 2020 00:55:54 +0000 (10:55 +1000)
The assembly for __get_user_asm() & __put_user_asm() uses memcpy()
when the size is 8.

However, the pointer is always a __user one while memcpy() expects
a plain one and so this cast creates a lot of warnings when using
Sparse.

So, fix this by adding a cast to 'void __force *' at memcpy()'s
argument.

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
arch/m68k/include/asm/uaccess_no.h

index 9651766a62af5c121e85ffeb063c2b2047a65ace..dcfb69361408aef1cbd0853c4ebebf5c45adf1e5 100644 (file)
@@ -42,7 +42,7 @@ static inline int _access_ok(unsigned long addr, unsigned long size)
        __put_user_asm(__pu_err, __pu_val, ptr, l);     \
        break;                                          \
     case 8:                                            \
-       memcpy(ptr, &__pu_val, sizeof (*(ptr))); \
+       memcpy((void __force *)ptr, &__pu_val, sizeof(*(ptr))); \
        break;                                          \
     default:                                           \
        __pu_err = __put_user_bad();                    \
@@ -85,7 +85,7 @@ extern int __put_user_bad(void);
            u64 l;                                              \
            __typeof__(*(ptr)) t;                               \
        } __gu_val;                                             \
-       memcpy(&__gu_val.l, ptr, sizeof(__gu_val.l));           \
+       memcpy(&__gu_val.l, (const void __force *)ptr, sizeof(__gu_val.l)); \
        (x) = __gu_val.t;                                       \
        break;                                                  \
     }                                                          \