lib/iov_iter.c:27:40: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kernel test robot
Date: Fri Jan 05 2024 - 01:56:20 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 1f874787ed9a2d78ed59cb21d0d90ac0178eceb0
commit: f1982740f5e77090bde41a9b84e257d69ec46598 iov_iter: Convert iterate*() to inline funcs
date: 3 months ago
config: csky-randconfig-r111-20231115 (https://download.01.org/0day-ci/archive/20240105/202401051457.EDSUSsof-lkp@xxxxxxxxx/config)
compiler: csky-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20240105/202401051457.EDSUSsof-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401051457.EDSUSsof-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> lib/iov_iter.c:27:40: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *to @@ got void [noderef] __user *iter_to @@
lib/iov_iter.c:27:40: sparse: expected void *to
lib/iov_iter.c:27:40: sparse: got void [noderef] __user *iter_to
lib/iov_iter.c:57:46: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got void [noderef] __user *iter_from @@
lib/iov_iter.c:57:46: sparse: expected void const *from
lib/iov_iter.c:57:46: sparse: got void [noderef] __user *iter_from
lib/iov_iter.c: note: in included file (through include/linux/sched/task.h, include/linux/sched/signal.h, include/linux/rcuwait.h, ...):
include/linux/uaccess.h:87:38: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got void const [noderef] __user *from @@
include/linux/uaccess.h:87:38: sparse: expected void const *from
include/linux/uaccess.h:87:38: sparse: got void const [noderef] __user *from
lib/iov_iter.c: note: in included file:
include/net/checksum.h:33:39: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected restricted __wsum [usertype] sum @@ got unsigned int @@
include/net/checksum.h:33:39: sparse: expected restricted __wsum [usertype] sum
include/net/checksum.h:33:39: sparse: got unsigned int
include/net/checksum.h:41:45: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected restricted __wsum [usertype] sum @@ got unsigned int @@
include/net/checksum.h:41:45: sparse: expected restricted __wsum [usertype] sum
include/net/checksum.h:41:45: sparse: got unsigned int

vim +27 lib/iov_iter.c

17
18 static __always_inline
19 size_t copy_to_user_iter(void __user *iter_to, size_t progress,
20 size_t len, void *from, void *priv2)
21 {
22 if (should_fail_usercopy())
23 return len;
24 if (access_ok(iter_to, len)) {
25 from += progress;
26 instrument_copy_to_user(iter_to, from, len);
> 27 len = raw_copy_to_user(iter_to, from, len);
28 }
29 return len;
30 }
31

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki