On Tue, Aug 13, 2019 at 4:01 PM kbuild test robot <lkp@xxxxxxxxx> wrote: > > tree: https://github.com/rgushchin/linux.git fix_vmstats > head: 4ec858b5201ae067607e82706b36588631c1b990 > commit: f198eb8345ed9cef77b65d1c0edffba3fa3f6d2a [199/221] lib: untag user pointers in strn*_user > config: sparc64-allmodconfig (attached as .config) > compiler: sparc64-linux-gcc (GCC) 7.4.0 > reproduce: > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > git checkout f198eb8345ed9cef77b65d1c0edffba3fa3f6d2a > # save the attached .config to linux build tree > GCC_VERSION=7.4.0 make.cross ARCH=sparc64 > > If you fix the issue, kindly add following tag > Reported-by: kbuild test robot <lkp@xxxxxxxxx> > > All warnings (new ones prefixed by >>): > > lib/strncpy_from_user.c: In function 'strncpy_from_user': > >> lib/strncpy_from_user.c:112:42: warning: passing argument 1 of 'untagged_addr' makes integer from pointer without a cast [-Wint-conversion] > src_addr = (unsigned long)untagged_addr(src); > ^~~ > In file included from arch/sparc/include/asm/pgtable.h:5:0, > from include/linux/mm.h:99, > from lib/strncpy_from_user.c:9: > arch/sparc/include/asm/pgtable_64.h:1081:29: note: expected 'long unsigned int' but argument is of type 'const char *' > static inline unsigned long untagged_addr(unsigned long start) > ^~~~~~~~~~~~~ > -- > lib/strnlen_user.c: In function 'strnlen_user': > >> lib/strnlen_user.c:113:42: warning: passing argument 1 of 'untagged_addr' makes integer from pointer without a cast [-Wint-conversion] > src_addr = (unsigned long)untagged_addr(str); > ^~~ > In file included from arch/sparc/include/asm/pgtable.h:5:0, > from include/linux/mm.h:99, > from lib/strnlen_user.c:5: > arch/sparc/include/asm/pgtable_64.h:1081:29: note: expected 'long unsigned int' but argument is of type 'const char *' > static inline unsigned long untagged_addr(unsigned long start) > ^~~~~~~~~~~~~ This is caused by the difference in untagged_addr() definitions for sparc and arm64. untagged_addr() for arm64 uses __typeof__ to avoid casting in places where it is used. Perhaps we should do something similar for sparc: diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h index 1599de730532..2c4cd82066cb 100644 --- a/arch/sparc/include/asm/pgtable_64.h +++ b/arch/sparc/include/asm/pgtable_64.h @@ -1078,7 +1078,7 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma, } #define io_remap_pfn_range io_remap_pfn_range -static inline unsigned long untagged_addr(unsigned long start) +static inline unsigned long __untagged_addr(unsigned long start) { if (adi_capable()) { long addr = start; @@ -1098,7 +1098,8 @@ static inline unsigned long untagged_addr(unsigned long start) return start; } -#define untagged_addr untagged_addr +#define untagged_addr(addr) \ + ((__typeof__(addr))(__untagged_addr((unsigned long)(addr))) static inline bool pte_access_permitted(pte_t pte, bool write) { Christoph, WDYT? > > vim +/untagged_addr +112 lib/strncpy_from_user.c > > 85 > 86 /** > 87 * strncpy_from_user: - Copy a NUL terminated string from userspace. > 88 * @dst: Destination address, in kernel space. This buffer must be at > 89 * least @count bytes long. > 90 * @src: Source address, in user space. > 91 * @count: Maximum number of bytes to copy, including the trailing NUL. > 92 * > 93 * Copies a NUL-terminated string from userspace to kernel space. > 94 * > 95 * On success, returns the length of the string (not including the trailing > 96 * NUL). > 97 * > 98 * If access to userspace fails, returns -EFAULT (some data may have been > 99 * copied). > 100 * > 101 * If @count is smaller than the length of the string, copies @count bytes > 102 * and returns @count. > 103 */ > 104 long strncpy_from_user(char *dst, const char __user *src, long count) > 105 { > 106 unsigned long max_addr, src_addr; > 107 > 108 if (unlikely(count <= 0)) > 109 return 0; > 110 > 111 max_addr = user_addr_max(); > > 112 src_addr = (unsigned long)untagged_addr(src); > > --- > 0-DAY kernel test infrastructure Open Source Technology Center > https://lists.01.org/pipermail/kbuild-all Intel Corporation