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

From: kernel test robot
Date: Mon Dec 11 2023 - 15:07:26 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: a39b6ac3781d46ba18193c9dbb2110f31e9bffe9
commit: aa5222e92f8000ed3c1c38dddf11c83222aadfb3 sched/deadline: Don't use dubious signed bitfields
date: 6 years ago
config: arm-randconfig-r131-20231117 (https://download.01.org/0day-ci/archive/20231212/202312120412.tOagTH3Q-lkp@xxxxxxxxx/config)
compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231212/202312120412.tOagTH3Q-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/202312120412.tOagTH3Q-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> drivers/watchdog/ath79_wdt.c:165:37: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected char const [noderef] __user *register __p @@ got char const * @@
drivers/watchdog/ath79_wdt.c:165:37: sparse: expected char const [noderef] __user *register __p
drivers/watchdog/ath79_wdt.c:165:37: sparse: got char const *
drivers/watchdog/ath79_wdt.c:239:27: sparse: sparse: incorrect type in initializer (incompatible argument 2 (different address spaces)) @@ expected int ( *write )( ... ) @@ got int ( * )( ... ) @@
drivers/watchdog/ath79_wdt.c:239:27: sparse: expected int ( *write )( ... )
drivers/watchdog/ath79_wdt.c:239:27: sparse: got int ( * )( ... )
--
kernel/futex.c: note: in included file:
>> arch/arm/include/asm/futex.h:58:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got unsigned int [noderef] [usertype] __user *uaddr @@
arch/arm/include/asm/futex.h:58:9: sparse: expected void const *
arch/arm/include/asm/futex.h:58:9: sparse: got unsigned int [noderef] [usertype] __user *uaddr
kernel/futex.c:1497:9: sparse: sparse: context imbalance in 'wake_futex_pi' - unexpected unlock
arch/arm/include/asm/futex.h:143:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got unsigned int [noderef] [usertype] __user *uaddr @@
arch/arm/include/asm/futex.h:143:17: sparse: expected void const *
arch/arm/include/asm/futex.h:143:17: sparse: got unsigned int [noderef] [usertype] __user *uaddr
arch/arm/include/asm/futex.h:146:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got unsigned int [noderef] [usertype] __user *uaddr @@
arch/arm/include/asm/futex.h:146:17: sparse: expected void const *
arch/arm/include/asm/futex.h:146:17: sparse: got unsigned int [noderef] [usertype] __user *uaddr
arch/arm/include/asm/futex.h:149:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got unsigned int [noderef] [usertype] __user *uaddr @@
arch/arm/include/asm/futex.h:149:17: sparse: expected void const *
arch/arm/include/asm/futex.h:149:17: sparse: got unsigned int [noderef] [usertype] __user *uaddr
arch/arm/include/asm/futex.h:152:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got unsigned int [noderef] [usertype] __user *uaddr @@
arch/arm/include/asm/futex.h:152:17: sparse: expected void const *
arch/arm/include/asm/futex.h:152:17: sparse: got unsigned int [noderef] [usertype] __user *uaddr
arch/arm/include/asm/futex.h:155:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got unsigned int [noderef] [usertype] __user *uaddr @@
arch/arm/include/asm/futex.h:155:17: sparse: expected void const *
arch/arm/include/asm/futex.h:155:17: sparse: got unsigned int [noderef] [usertype] __user *uaddr
kernel/futex.c:1658:33: sparse: sparse: context imbalance in 'futex_wake_op' - different lock contexts for basic block
kernel/futex.c:1949:41: sparse: sparse: context imbalance in 'futex_requeue' - different lock contexts for basic block
kernel/futex.c:2467:13: sparse: sparse: context imbalance in 'futex_wait_queue_me' - unexpected unlock
kernel/futex.c:2570:9: sparse: sparse: context imbalance in 'futex_wait_setup' - different lock contexts for basic block
kernel/futex.c:2859:12: sparse: sparse: context imbalance in 'futex_unlock_pi' - different lock contexts for basic block
kernel/futex.c:3127:29: sparse: sparse: context imbalance in 'futex_wait_requeue_pi' - unexpected unlock
In file included from kernel/futex.c:56:
include/linux/syscalls.h:211:25: warning: 'sys_set_robust_list' alias between functions of incompatible types 'long int(struct robust_list_head *, size_t)' {aka 'long int(struct robust_list_head *, unsigned int)'} and 'long int(long int, long int)' [-Wattribute-alias=]
211 | asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) 30- | ^~~
include/linux/syscalls.h:207:9: note: in expansion of macro '__SYSCALL_DEFINEx'
207 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
include/linux/syscalls.h:197:36: note: in expansion of macro 'SYSCALL_DEFINEx'
197 | #define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
| ^~~~~~~~~~~~~~~
kernel/futex.c:3262:1: note: in expansion of macro 'SYSCALL_DEFINE2'
3262 | SYSCALL_DEFINE2(set_robust_list, struct robust_list_head __user *, head,
| ^~~~~~~~~~~~~~~
include/linux/syscalls.h:215:25: note: aliased declaration here
215 | asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) 42- | ^~~
include/linux/syscalls.h:207:9: note: in expansion of macro '__SYSCALL_DEFINEx'
207 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
include/linux/syscalls.h:197:36: note: in expansion of macro 'SYSCALL_DEFINEx'
197 | #define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
| ^~~~~~~~~~~~~~~
kernel/futex.c:3262:1: note: in expansion of macro 'SYSCALL_DEFINE2'
3262 | SYSCALL_DEFINE2(set_robust_list, struct robust_list_head __user *, head,
| ^~~~~~~~~~~~~~~
include/linux/syscalls.h:211:25: warning: 'sys_futex' alias between functions of incompatible types 'long int(u32 *, int, u32, struct timespec *, u32 *, u32)' {aka 'long int(unsigned int *, int, unsigned int, struct timespec *, unsigned int *, unsigned int)'} and 'long int(long int, long int, long int, long int, long int, long int)' [-Wattribute-alias=]
211 | asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) 54- | ^~~
include/linux/syscalls.h:207:9: note: in expansion of macro '__SYSCALL_DEFINEx'
207 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
include/linux/syscalls.h:201:36: note: in expansion of macro 'SYSCALL_DEFINEx'
201 | #define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
| ^~~~~~~~~~~~~~~
kernel/futex.c:3519:1: note: in expansion of macro 'SYSCALL_DEFINE6'
3519 | SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
| ^~~~~~~~~~~~~~~
include/linux/syscalls.h:215:25: note: aliased declaration here
215 | asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) 66- | ^~~
include/linux/syscalls.h:207:9: note: in expansion of macro '__SYSCALL_DEFINEx'
207 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
include/linux/syscalls.h:201:36: note: in expansion of macro 'SYSCALL_DEFINEx'
201 | #define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
| ^~~~~~~~~~~~~~~
kernel/futex.c:3519:1: note: in expansion of macro 'SYSCALL_DEFINE6'
3519 | SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
| ^~~~~~~~~~~~~~~
include/linux/syscalls.h:211:25: warning: 'sys_get_robust_list' alias between functions of incompatible types 'long int(int, struct robust_list_head **, size_t *)' {aka 'long int(int, struct robust_list_head **, unsigned int *)'} and 'long int(long int, long int, long int)' [-Wattribute-alias=]
211 | asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) 78- | ^~~
include/linux/syscalls.h:207:9: note: in expansion of macro '__SYSCALL_DEFINEx'
207 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
include/linux/syscalls.h:198:36: note: in expansion of macro 'SYSCALL_DEFINEx'
198 | #define SYSCALL_DEFINE3(name, ...) SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
| ^~~~~~~~~~~~~~~
kernel/futex.c:3284:1: note: in expansion of macro 'SYSCALL_DEFINE3'
3284 | SYSCALL_DEFINE3(get_robust_list, int, pid,
| ^~~~~~~~~~~~~~~
include/linux/syscalls.h:215:25: note: aliased declaration here
215 | asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) 90- | ^~~
include/linux/syscalls.h:207:9: note: in expansion of macro '__SYSCALL_DEFINEx'
207 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
include/linux/syscalls.h:198:36: note: in expansion of macro 'SYSCALL_DEFINEx'
198 | #define SYSCALL_DEFINE3(name, ...) SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
| ^~~~~~~~~~~~~~~
kernel/futex.c:3284:1: note: in expansion of macro 'SYSCALL_DEFINE3'
3284 | SYSCALL_DEFINE3(get_robust_list, int, pid,
| ^~~~~~~~~~~~~~~
kernel/futex.c: In function 'do_futex':
kernel/futex.c:3489:22: warning: this statement may fall through [-Wimplicit-fallthrough=]
3489 | val3 = FUTEX_BITSET_MATCH_ANY;

vim +165 drivers/watchdog/ath79_wdt.c

f8394f61c66f48 Gabor Juhos 2011-01-04 152
f8394f61c66f48 Gabor Juhos 2011-01-04 153 static ssize_t ath79_wdt_write(struct file *file, const char *data,
f8394f61c66f48 Gabor Juhos 2011-01-04 154 size_t len, loff_t *ppos)
f8394f61c66f48 Gabor Juhos 2011-01-04 155 {
f8394f61c66f48 Gabor Juhos 2011-01-04 156 if (len) {
f8394f61c66f48 Gabor Juhos 2011-01-04 157 if (!nowayout) {
f8394f61c66f48 Gabor Juhos 2011-01-04 158 size_t i;
f8394f61c66f48 Gabor Juhos 2011-01-04 159
f8394f61c66f48 Gabor Juhos 2011-01-04 160 clear_bit(WDT_FLAGS_EXPECT_CLOSE, &wdt_flags);
f8394f61c66f48 Gabor Juhos 2011-01-04 161
f8394f61c66f48 Gabor Juhos 2011-01-04 162 for (i = 0; i != len; i++) {
f8394f61c66f48 Gabor Juhos 2011-01-04 163 char c;
f8394f61c66f48 Gabor Juhos 2011-01-04 164
f8394f61c66f48 Gabor Juhos 2011-01-04 @165 if (get_user(c, data + i))
f8394f61c66f48 Gabor Juhos 2011-01-04 166 return -EFAULT;
f8394f61c66f48 Gabor Juhos 2011-01-04 167
f8394f61c66f48 Gabor Juhos 2011-01-04 168 if (c == 'V')
f8394f61c66f48 Gabor Juhos 2011-01-04 169 set_bit(WDT_FLAGS_EXPECT_CLOSE,
f8394f61c66f48 Gabor Juhos 2011-01-04 170 &wdt_flags);
f8394f61c66f48 Gabor Juhos 2011-01-04 171 }
f8394f61c66f48 Gabor Juhos 2011-01-04 172 }
f8394f61c66f48 Gabor Juhos 2011-01-04 173
f8394f61c66f48 Gabor Juhos 2011-01-04 174 ath79_wdt_keepalive();
f8394f61c66f48 Gabor Juhos 2011-01-04 175 }
f8394f61c66f48 Gabor Juhos 2011-01-04 176
f8394f61c66f48 Gabor Juhos 2011-01-04 177 return len;
f8394f61c66f48 Gabor Juhos 2011-01-04 178 }
f8394f61c66f48 Gabor Juhos 2011-01-04 179

:::::: The code at line 165 was first introduced by commit
:::::: f8394f61c66f48b1fe9d6964ddce492d7f9a4cd9 watchdog: add driver for the Atheros AR71XX/AR724X/AR913X SoCs

:::::: TO: Gabor Juhos <juhosg@xxxxxxxxxxx>
:::::: CC: Wim Van Sebroeck <wim@xxxxxxxxx>

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