kernel/module/main.c:4169:1: sparse: sparse: Using plain integer as NULL pointer

From: kernel test robot
Date: Sat Feb 18 2023 - 18:16:22 EST


Hi Aaron,

First bad commit (maybe != root cause):

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 5e725d112e1a54c2611d5dffd124a79415d0f0de
commit: cfc1d277891eb499b3b5354df33b30f598683e90 module: Move all into module/
date: 11 months ago
config: s390-randconfig-s052-20230219 (https://download.01.org/0day-ci/archive/20230219/202302190638.fKs1ga5r-lkp@xxxxxxxxx/config)
compiler: s390-linux-gcc (GCC) 12.1.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.4-39-gce1a6720-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cfc1d277891eb499b3b5354df33b30f598683e90
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout cfc1d277891eb499b3b5354df33b30f598683e90
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=s390 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=s390 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202302190638.fKs1ga5r-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
kernel/module/main.c:2761:23: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct mod_kallsyms [noderef] __rcu *kallsyms @@ got void * @@
kernel/module/main.c:2761:23: sparse: expected struct mod_kallsyms [noderef] __rcu *kallsyms
kernel/module/main.c:2761:23: sparse: got void *
>> kernel/module/main.c:4169:1: sparse: sparse: Using plain integer as NULL pointer
>> kernel/module/main.c:4169:1: sparse: sparse: Using plain integer as NULL pointer
>> kernel/module/main.c:4169:1: sparse: sparse: Using plain integer as NULL pointer
>> kernel/module/main.c:4169:1: sparse: sparse: Using plain integer as NULL pointer
kernel/module/main.c:4189:1: sparse: sparse: Using plain integer as NULL pointer
kernel/module/main.c:4189:1: sparse: sparse: Using plain integer as NULL pointer
kernel/module/main.c: note: in included file (through include/linux/mm_types.h, include/linux/buildid.h, include/linux/module.h, ...):
include/linux/rbtree.h:74:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/rbtree.h:74:9: sparse: struct rb_node [noderef] __rcu *
include/linux/rbtree.h:74:9: sparse: struct rb_node *
include/linux/rbtree.h:74:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/rbtree.h:74:9: sparse: struct rb_node [noderef] __rcu *
include/linux/rbtree.h:74:9: sparse: struct rb_node *

vim +4169 kernel/module/main.c

b99b87f70c7785 kernel/module.c Peter Oberparleiter 2009-06-17 4168
17da2bd90abf42 kernel/module.c Heiko Carstens 2009-01-14 @4169 SYSCALL_DEFINE3(init_module, void __user *, umod,
17da2bd90abf42 kernel/module.c Heiko Carstens 2009-01-14 4170 unsigned long, len, const char __user *, uargs)
^1da177e4c3f41 kernel/module.c Linus Torvalds 2005-04-16 4171 {
34e1169d996ab1 kernel/module.c Kees Cook 2012-10-16 4172 int err;
34e1169d996ab1 kernel/module.c Kees Cook 2012-10-16 4173 struct load_info info = { };
^1da177e4c3f41 kernel/module.c Linus Torvalds 2005-04-16 4174
34e1169d996ab1 kernel/module.c Kees Cook 2012-10-16 4175 err = may_init_module();
34e1169d996ab1 kernel/module.c Kees Cook 2012-10-16 4176 if (err)
34e1169d996ab1 kernel/module.c Kees Cook 2012-10-16 4177 return err;
^1da177e4c3f41 kernel/module.c Linus Torvalds 2005-04-16 4178
34e1169d996ab1 kernel/module.c Kees Cook 2012-10-16 4179 pr_debug("init_module: umod=%p, len=%lu, uargs=%p\n",
34e1169d996ab1 kernel/module.c Kees Cook 2012-10-16 4180 umod, len, uargs);
^1da177e4c3f41 kernel/module.c Linus Torvalds 2005-04-16 4181
34e1169d996ab1 kernel/module.c Kees Cook 2012-10-16 4182 err = copy_module_from_user(umod, len, &info);
34e1169d996ab1 kernel/module.c Kees Cook 2012-10-16 4183 if (err)
34e1169d996ab1 kernel/module.c Kees Cook 2012-10-16 4184 return err;
^1da177e4c3f41 kernel/module.c Linus Torvalds 2005-04-16 4185
2f3238aebedb24 kernel/module.c Rusty Russell 2012-10-22 4186 return load_module(&info, uargs, 0);
e24e2e64c468c8 kernel/module.c Alexey Dobriyan 2008-03-10 4187 }
94462ad3b14739 kernel/module.c Steven Rostedt 2010-11-29 4188

:::::: The code at line 4169 was first introduced by commit
:::::: 17da2bd90abf428523de0fb98f7075e00e3ed42e [CVE-2009-0029] System call wrappers part 08

:::::: TO: Heiko Carstens <heiko.carstens@xxxxxxxxxx>
:::::: CC: Heiko Carstens <heiko.carstens@xxxxxxxxxx>

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