fs/coda/psdev.c:79:24: sparse: sparse: incorrect type in initializer (different address spaces)

From: kernel test robot
Date: Sat Aug 08 2020 - 14:51:58 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 449dc8c97089a6e09fb2dac4d92b1b7ac0eb7c1e
commit: 670d0a4b10704667765f7d18f7592993d02783aa sparse: use identifiers to define address spaces
date: 7 weeks ago
config: openrisc-randconfig-s032-20200809 (attached as .config)
compiler: or1k-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.2-118-ge1578773-dirty
git checkout 670d0a4b10704667765f7d18f7592993d02783aa
# 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=openrisc

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/coda/psdev.c:79:24: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int *__pu_addr @@ got int [noderef] __user * @@
fs/coda/psdev.c:79:24: sparse: expected int *__pu_addr
>> fs/coda/psdev.c:79:24: sparse: got int [noderef] __user *
fs/coda/psdev.c: note: in included file (through include/linux/sched/task.h, include/linux/sched/signal.h):
include/linux/uaccess.h:131:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *to @@ got void [noderef] __user *to @@
include/linux/uaccess.h:131:38: sparse: expected void *to
include/linux/uaccess.h:131:38: sparse: got void [noderef] __user *to
include/linux/uaccess.h:131:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got void const *from @@
include/linux/uaccess.h:131:42: sparse: expected void const [noderef] __user *from
include/linux/uaccess.h:131:42: sparse: got void const *from
fs/coda/psdev.c: note: in included file (through include/linux/uaccess.h, include/linux/sched/task.h, include/linux/sched/signal.h):
arch/openrisc/include/asm/uaccess.h:246:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got void const [noderef] __user *from @@
arch/openrisc/include/asm/uaccess.h:246:55: sparse: expected void const *from
arch/openrisc/include/asm/uaccess.h:246:55: sparse: got void const [noderef] __user *from
--
security/smack/smack_lsm.c:1776:61: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct cred const *cred @@ got struct cred const [noderef] __rcu *cred @@
security/smack/smack_lsm.c:1776:61: sparse: expected struct cred const *cred
security/smack/smack_lsm.c:1776:61: sparse: got struct cred const [noderef] __rcu *cred
security/smack/smack_lsm.c:2494:27: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] dport @@ got unsigned short [usertype] @@
security/smack/smack_lsm.c:2494:27: sparse: expected restricted __be16 [usertype] dport
security/smack/smack_lsm.c:2494:27: sparse: got unsigned short [usertype]
>> security/smack/smack_lsm.c:3955:13: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int *__pu_addr @@ got int [noderef] __user *optlen @@
security/smack/smack_lsm.c:3955:13: sparse: expected int *__pu_addr
>> security/smack/smack_lsm.c:3955:13: sparse: got int [noderef] __user *optlen
security/smack/smack_lsm.c:4839:30: sparse: sparse: cast removes address space '__rcu' of expression
security/smack/smack_lsm.c: note: in included file (through include/linux/sched/task.h, include/linux/sched/signal.h, include/linux/rcuwait.h, ...):
include/linux/uaccess.h:131:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *to @@ got void [noderef] __user *to @@
include/linux/uaccess.h:131:38: sparse: expected void *to
include/linux/uaccess.h:131:38: sparse: got void [noderef] __user *to
include/linux/uaccess.h:131:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got void const *from @@
include/linux/uaccess.h:131:42: sparse: expected void const [noderef] __user *from
include/linux/uaccess.h:131:42: sparse: got void const *from
security/smack/smack_lsm.c: note: in included file (through include/linux/uaccess.h, include/linux/sched/task.h, include/linux/sched/signal.h, ...):
arch/openrisc/include/asm/uaccess.h:246:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got void const [noderef] __user *from @@
arch/openrisc/include/asm/uaccess.h:246:55: sparse: expected void const *from
arch/openrisc/include/asm/uaccess.h:246:55: sparse: got void const [noderef] __user *from
--
>> net/sched/act_bpf.c:132:35: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *src @@ got unsigned char [noderef] __rcu * @@
net/sched/act_bpf.c:132:35: sparse: expected void const *src
net/sched/act_bpf.c:132:35: sparse: got unsigned char [noderef] __rcu *
net/sched/act_bpf.c:125:50: sparse: sparse: dereference of noderef expression
net/sched/act_bpf.c:125:50: sparse: sparse: dereference of noderef expression
--
>> net/atm/mpoa_proc.c:223:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected char const *__gu_addr @@ got char const [noderef] __user * @@
net/atm/mpoa_proc.c:223:21: sparse: expected char const *__gu_addr
>> net/atm/mpoa_proc.c:223:21: sparse: got char const [noderef] __user *
--
>> net/l2tp/l2tp_ip.c:593:16: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int *__pu_addr @@ got int [noderef] __user * @@
net/l2tp/l2tp_ip.c:593:16: sparse: expected int *__pu_addr
>> net/l2tp/l2tp_ip.c:593:16: sparse: got int [noderef] __user *
net/l2tp/l2tp_ip.c: note: in included file (through include/asm-generic/atomic.h, arch/openrisc/include/asm/atomic.h, include/linux/atomic.h, ...):
arch/openrisc/include/asm/cmpxchg.h:101:29: sparse: sparse: shift too big (32) for type int

vim +79 fs/coda/psdev.c

^1da177e4c3f41 Linus Torvalds 2005-04-16 71
977183902a52d1 Arnd Bergmann 2010-04-27 72 static long coda_psdev_ioctl(struct file * filp, unsigned int cmd, unsigned long arg)
^1da177e4c3f41 Linus Torvalds 2005-04-16 73 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 74 unsigned int data;
^1da177e4c3f41 Linus Torvalds 2005-04-16 75
^1da177e4c3f41 Linus Torvalds 2005-04-16 76 switch(cmd) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 77 case CIOC_KERNEL_VERSION:
^1da177e4c3f41 Linus Torvalds 2005-04-16 78 data = CODA_KERNEL_VERSION;
^1da177e4c3f41 Linus Torvalds 2005-04-16 @79 return put_user(data, (int __user *) arg);
^1da177e4c3f41 Linus Torvalds 2005-04-16 80 default:
^1da177e4c3f41 Linus Torvalds 2005-04-16 81 return -ENOTTY;
^1da177e4c3f41 Linus Torvalds 2005-04-16 82 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 83
^1da177e4c3f41 Linus Torvalds 2005-04-16 84 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 85 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 86

:::::: The code at line 79 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