fs/jfs/jfs_debug.c:36:13: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kernel test robot
Date: Tue Jan 19 2021 - 19:20:15 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 1e2a199f6ccdc15cf111d68d212e2fd4ce65682e
commit: e5fc436f06eef54ef512ea55a9db8eb9f2e76959 sparse: use static inline for __chk_{user,io}_ptr()
date: 5 months ago
config: sh-randconfig-s031-20210120 (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-208-g46a52ca4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e5fc436f06eef54ef512ea55a9db8eb9f2e76959
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout e5fc436f06eef54ef512ea55a9db8eb9f2e76959
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=sh

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


"sparse warnings: (new ones prefixed by >>)"
fs/jfs/jfs_debug.c:36:13: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected char const *__gu_addr @@ got char const [noderef] __user *buffer @@
fs/jfs/jfs_debug.c:36:13: sparse: expected char const *__gu_addr
fs/jfs/jfs_debug.c:36:13: sparse: got char const [noderef] __user *buffer
>> fs/jfs/jfs_debug.c:36:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got char const *__gu_addr @@
fs/jfs/jfs_debug.c:36:13: sparse: expected void const volatile [noderef] __user *ptr
fs/jfs/jfs_debug.c:36:13: sparse: got char const *__gu_addr
--
lib/test_user_copy.c:165:16: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *addr @@ got void [noderef] __user *__cl_addr @@
lib/test_user_copy.c:165:16: sparse: expected void *addr
lib/test_user_copy.c:165:16: sparse: got void [noderef] __user *__cl_addr
lib/test_user_copy.c:239:9: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned char const *__gu_addr @@ got unsigned char [noderef] [usertype] __user * @@
lib/test_user_copy.c:239:9: sparse: expected unsigned char const *__gu_addr
lib/test_user_copy.c:239:9: sparse: got unsigned char [noderef] [usertype] __user *
>> lib/test_user_copy.c:239:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned char const *__gu_addr @@
lib/test_user_copy.c:239:9: sparse: expected void const volatile [noderef] __user *ptr
lib/test_user_copy.c:239:9: sparse: got unsigned char const *__gu_addr
lib/test_user_copy.c:240:9: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned short const *__gu_addr @@ got unsigned short [noderef] [usertype] __user * @@
lib/test_user_copy.c:240:9: sparse: expected unsigned short const *__gu_addr
lib/test_user_copy.c:240:9: sparse: got unsigned short [noderef] [usertype] __user *
>> lib/test_user_copy.c:240:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned short const *__gu_addr @@
lib/test_user_copy.c:240:9: sparse: expected void const volatile [noderef] __user *ptr
lib/test_user_copy.c:240:9: sparse: got unsigned short const *__gu_addr
lib/test_user_copy.c:241:9: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int const *__gu_addr @@ got unsigned int [noderef] [usertype] __user * @@
lib/test_user_copy.c:241:9: sparse: expected unsigned int const *__gu_addr
lib/test_user_copy.c:241:9: sparse: got unsigned int [noderef] [usertype] __user *
>> lib/test_user_copy.c:241:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned int const *__gu_addr @@
lib/test_user_copy.c:241:9: sparse: expected void const volatile [noderef] __user *ptr
lib/test_user_copy.c:241:9: sparse: got unsigned int const *__gu_addr
lib/test_user_copy.c:302:9: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned char const *__gu_addr @@ got unsigned char [noderef] [usertype] __user * @@
lib/test_user_copy.c:302:9: sparse: expected unsigned char const *__gu_addr
lib/test_user_copy.c:302:9: sparse: got unsigned char [noderef] [usertype] __user *
lib/test_user_copy.c:302:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned char const *__gu_addr @@
lib/test_user_copy.c:302:9: sparse: expected void const volatile [noderef] __user *ptr
lib/test_user_copy.c:302:9: sparse: got unsigned char const *__gu_addr
lib/test_user_copy.c:303:9: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned short const *__gu_addr @@ got unsigned short [noderef] [usertype] __user * @@
lib/test_user_copy.c:303:9: sparse: expected unsigned short const *__gu_addr
lib/test_user_copy.c:303:9: sparse: got unsigned short [noderef] [usertype] __user *
lib/test_user_copy.c:303:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned short const *__gu_addr @@
lib/test_user_copy.c:303:9: sparse: expected void const volatile [noderef] __user *ptr
lib/test_user_copy.c:303:9: sparse: got unsigned short const *__gu_addr
lib/test_user_copy.c:304:9: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int const *__gu_addr @@ got unsigned int [noderef] [usertype] __user * @@
lib/test_user_copy.c:304:9: sparse: expected unsigned int const *__gu_addr
lib/test_user_copy.c:304:9: sparse: got unsigned int [noderef] [usertype] __user *
lib/test_user_copy.c:304:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned int const *__gu_addr @@
lib/test_user_copy.c:304:9: sparse: expected void const volatile [noderef] __user *ptr
lib/test_user_copy.c:304:9: sparse: got unsigned int const *__gu_addr

vim +36 fs/jfs/jfs_debug.c

^1da177e4c3f4152 Linus Torvalds 2005-04-16 30
b2e03ca7485cac03 Alexey Dobriyan 2008-05-13 31 static ssize_t jfs_loglevel_proc_write(struct file *file,
b2e03ca7485cac03 Alexey Dobriyan 2008-05-13 32 const char __user *buffer, size_t count, loff_t *ppos)
^1da177e4c3f4152 Linus Torvalds 2005-04-16 33 {
^1da177e4c3f4152 Linus Torvalds 2005-04-16 34 char c;
^1da177e4c3f4152 Linus Torvalds 2005-04-16 35
^1da177e4c3f4152 Linus Torvalds 2005-04-16 @36 if (get_user(c, buffer))
^1da177e4c3f4152 Linus Torvalds 2005-04-16 37 return -EFAULT;
^1da177e4c3f4152 Linus Torvalds 2005-04-16 38
^1da177e4c3f4152 Linus Torvalds 2005-04-16 39 /* yes, I know this is an ASCIIism. --hch */
^1da177e4c3f4152 Linus Torvalds 2005-04-16 40 if (c < '0' || c > '9')
^1da177e4c3f4152 Linus Torvalds 2005-04-16 41 return -EINVAL;
^1da177e4c3f4152 Linus Torvalds 2005-04-16 42 jfsloglevel = c - '0';
^1da177e4c3f4152 Linus Torvalds 2005-04-16 43 return count;
^1da177e4c3f4152 Linus Torvalds 2005-04-16 44 }
b2e03ca7485cac03 Alexey Dobriyan 2008-05-13 45

:::::: The code at line 36 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip