drivers/watchdog/rc32434_wdt.c:176:37: sparse: sparse: incorrect type in initializer (different address spaces)

From: kernel test robot
Date: Sun Mar 20 2022 - 00:23:58 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 34e047aa16c0123bbae8e2f6df33e5ecc1f56601
commit: ddb002d6d6af12c45dd9d565cadf0f40b36b7c25 MIPS: uaccess: Reduce number of nested macros
date: 11 months ago
config: mips-randconfig-s032-20220319 (https://download.01.org/0day-ci/archive/20220320/202203201245.WYJq6i13-lkp@xxxxxxxxx/config)
compiler: mipsel-linux-gcc (GCC) 11.2.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-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ddb002d6d6af12c45dd9d565cadf0f40b36b7c25
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout ddb002d6d6af12c45dd9d565cadf0f40b36b7c25
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=mips SHELL=/bin/bash drivers/watchdog/

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


sparse warnings: (new ones prefixed by >>)
command-line: note: in included file:
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE redefined
builtin:0:0: sparse: this was the original definition
>> drivers/watchdog/rc32434_wdt.c:176:37: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected char const [noderef] __user *__p @@ got char const * @@
drivers/watchdog/rc32434_wdt.c:176:37: sparse: expected char const [noderef] __user *__p
drivers/watchdog/rc32434_wdt.c:176:37: sparse: got char const *
drivers/watchdog/rc32434_wdt.c:246:27: sparse: sparse: incorrect type in initializer (incompatible argument 2 (different address spaces)) @@ expected int ( *write )( ... ) @@ got int ( * )( ... ) @@
drivers/watchdog/rc32434_wdt.c:246:27: sparse: expected int ( *write )( ... )
drivers/watchdog/rc32434_wdt.c:246:27: sparse: got int ( * )( ... )

vim +176 drivers/watchdog/rc32434_wdt.c

03ec58568a3c66 Florian Fainelli 2008-02-25 163
03ec58568a3c66 Florian Fainelli 2008-02-25 164 static ssize_t rc32434_wdt_write(struct file *file, const char *data,
03ec58568a3c66 Florian Fainelli 2008-02-25 165 size_t len, loff_t *ppos)
03ec58568a3c66 Florian Fainelli 2008-02-25 166 {
03ec58568a3c66 Florian Fainelli 2008-02-25 167 if (len) {
03ec58568a3c66 Florian Fainelli 2008-02-25 168 if (!nowayout) {
03ec58568a3c66 Florian Fainelli 2008-02-25 169 size_t i;
03ec58568a3c66 Florian Fainelli 2008-02-25 170
03ec58568a3c66 Florian Fainelli 2008-02-25 171 /* In case it was set long ago */
03ec58568a3c66 Florian Fainelli 2008-02-25 172 expect_close = 0;
03ec58568a3c66 Florian Fainelli 2008-02-25 173
03ec58568a3c66 Florian Fainelli 2008-02-25 174 for (i = 0; i != len; i++) {
03ec58568a3c66 Florian Fainelli 2008-02-25 175 char c;
03ec58568a3c66 Florian Fainelli 2008-02-25 @176 if (get_user(c, data + i))
03ec58568a3c66 Florian Fainelli 2008-02-25 177 return -EFAULT;
03ec58568a3c66 Florian Fainelli 2008-02-25 178 if (c == 'V')
0af98d37e85e69 Phil Sutter 2009-02-08 179 expect_close = 42;
03ec58568a3c66 Florian Fainelli 2008-02-25 180 }
03ec58568a3c66 Florian Fainelli 2008-02-25 181 }
0af98d37e85e69 Phil Sutter 2009-02-08 182 rc32434_wdt_ping();
03ec58568a3c66 Florian Fainelli 2008-02-25 183 return len;
03ec58568a3c66 Florian Fainelli 2008-02-25 184 }
03ec58568a3c66 Florian Fainelli 2008-02-25 185 return 0;
03ec58568a3c66 Florian Fainelli 2008-02-25 186 }
03ec58568a3c66 Florian Fainelli 2008-02-25 187

:::::: The code at line 176 was first introduced by commit
:::::: 03ec58568a3c66cac4b23ff74db95c966a1521de [WATCHDOG] Add support for the IDT RC32434 watchdog

:::::: TO: Florian Fainelli <florian.fainelli@xxxxxxxxxxxxx>
:::::: CC: Wim Van Sebroeck <wim@xxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://01.org/lkp