include/net/checksum.h:31:39: sparse: sparse: incorrect type in argument 3 (different base types)

From: kernel test robot
Date: Tue Dec 26 2023 - 04:53:09 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: fbafc3e621c3f4ded43720fdb1d6ce1728ec664e
commit: d911c67e10b47eb1ace08dcf95ce98fe4d408c88 x86: kasan: kmsan: support CONFIG_GENERIC_CSUM on x86, enable it for KASAN/KMSAN
date: 1 year, 3 months ago
config: x86_64-randconfig-122-20231101 (https://download.01.org/0day-ci/archive/20231226/202312261711.KKO6zAnz-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231226/202312261711.KKO6zAnz-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/202312261711.KKO6zAnz-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
lib/iov_iter.c: note: in included file:
>> include/net/checksum.h:31:39: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected restricted __wsum [usertype] sum @@ got unsigned int @@
include/net/checksum.h:31:39: sparse: expected restricted __wsum [usertype] sum
include/net/checksum.h:31:39: sparse: got unsigned int
>> include/net/checksum.h:31:39: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected restricted __wsum [usertype] sum @@ got unsigned int @@
include/net/checksum.h:31:39: sparse: expected restricted __wsum [usertype] sum
include/net/checksum.h:31:39: sparse: got unsigned int
include/net/checksum.h:39:45: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected restricted __wsum [usertype] sum @@ got unsigned int @@
include/net/checksum.h:39:45: sparse: expected restricted __wsum [usertype] sum
include/net/checksum.h:39:45: sparse: got unsigned int
include/net/checksum.h:39:45: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected restricted __wsum [usertype] sum @@ got unsigned int @@
include/net/checksum.h:39:45: sparse: expected restricted __wsum [usertype] sum
include/net/checksum.h:39:45: sparse: got unsigned int

vim +31 include/net/checksum.h

^1da177e4c3f41 Linus Torvalds 2005-04-16 23
^1da177e4c3f41 Linus Torvalds 2005-04-16 24 #ifndef _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
5486f5bf790b5c Christophe Leroy 2022-02-17 25 static __always_inline
56649d5d3c4cb0 Al Viro 2006-11-14 26 __wsum csum_and_copy_from_user (const void __user *src, void *dst,
c693cc4676a055 Al Viro 2020-07-11 27 int len)
^1da177e4c3f41 Linus Torvalds 2005-04-16 28 {
5904122c46581a Al Viro 2020-02-18 29 if (copy_from_user(dst, src, len))
c693cc4676a055 Al Viro 2020-07-11 30 return 0;
c693cc4676a055 Al Viro 2020-07-11 @31 return csum_partial(dst, len, ~0U);
^1da177e4c3f41 Linus Torvalds 2005-04-16 32 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 33 #endif
^1da177e4c3f41 Linus Torvalds 2005-04-16 34

:::::: The code at line 31 was first introduced by commit
:::::: c693cc4676a055c4126e487b30b0a96ea7ec9936 saner calling conventions for csum_and_copy_..._user()

:::::: TO: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
:::::: CC: Al Viro <viro@xxxxxxxxxxxxxxxxxx>

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