arch/arm/include/asm/futex.h:146:17: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kernel test robot
Date: Sat Jun 24 2023 - 19:34:31 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: a92b7d26c743b9dc06d520f863d624e94978a1d9
commit: 09f6b27d5ddd9ad0ec096d1b0f8decdacc70f0f8 ARM: dove: multiplatform support
date: 1 year, 3 months ago
config: arm-randconfig-s042-20230625 (https://download.01.org/0day-ci/archive/20230625/202306250757.SGJ4havv-lkp@xxxxxxxxx/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230625/202306250757.SGJ4havv-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/202306250757.SGJ4havv-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
kernel/futex/waitwake.c: note: in included file (through kernel/futex/futex.h):
>> arch/arm/include/asm/futex.h:146:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *ptr @@ got unsigned int [noderef] [usertype] __user *uaddr @@
arch/arm/include/asm/futex.h:146:17: sparse: expected void const *ptr
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 *ptr @@ got unsigned int [noderef] [usertype] __user *uaddr @@
arch/arm/include/asm/futex.h:149:17: sparse: expected void const *ptr
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 *ptr @@ got unsigned int [noderef] [usertype] __user *uaddr @@
arch/arm/include/asm/futex.h:152:17: sparse: expected void const *ptr
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 *ptr @@ got unsigned int [noderef] [usertype] __user *uaddr @@
arch/arm/include/asm/futex.h:155:17: sparse: expected void const *ptr
arch/arm/include/asm/futex.h:155:17: sparse: got unsigned int [noderef] [usertype] __user *uaddr
arch/arm/include/asm/futex.h:158:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *ptr @@ got unsigned int [noderef] [usertype] __user *uaddr @@
arch/arm/include/asm/futex.h:158:17: sparse: expected void const *ptr
arch/arm/include/asm/futex.h:158:17: sparse: got unsigned int [noderef] [usertype] __user *uaddr
kernel/futex/waitwake.c:262:33: sparse: sparse: context imbalance in 'futex_wake_op' - different lock contexts for basic block
kernel/futex/waitwake.c:328:6: sparse: sparse: context imbalance in 'futex_wait_queue' - unexpected unlock
kernel/futex/waitwake.c:449:36: sparse: sparse: context imbalance in 'futex_wait_multiple_setup' - unexpected unlock

vim +146 arch/arm/include/asm/futex.h

e589ed23dd27b8 Mikael Pettersson 2008-08-20 143
e589ed23dd27b8 Mikael Pettersson 2008-08-20 144 switch (op) {
e589ed23dd27b8 Mikael Pettersson 2008-08-20 145 case FUTEX_OP_SET:
df77abcafc8dc8 Will Deacon 2011-09-23 @146 __futex_atomic_op("mov %0, %4", ret, oldval, tmp, uaddr, oparg);
e589ed23dd27b8 Mikael Pettersson 2008-08-20 147 break;
e589ed23dd27b8 Mikael Pettersson 2008-08-20 148 case FUTEX_OP_ADD:
df77abcafc8dc8 Will Deacon 2011-09-23 149 __futex_atomic_op("add %0, %1, %4", ret, oldval, tmp, uaddr, oparg);
e589ed23dd27b8 Mikael Pettersson 2008-08-20 150 break;
e589ed23dd27b8 Mikael Pettersson 2008-08-20 151 case FUTEX_OP_OR:
df77abcafc8dc8 Will Deacon 2011-09-23 152 __futex_atomic_op("orr %0, %1, %4", ret, oldval, tmp, uaddr, oparg);
e589ed23dd27b8 Mikael Pettersson 2008-08-20 153 break;
e589ed23dd27b8 Mikael Pettersson 2008-08-20 154 case FUTEX_OP_ANDN:
df77abcafc8dc8 Will Deacon 2011-09-23 155 __futex_atomic_op("and %0, %1, %4", ret, oldval, tmp, uaddr, ~oparg);
e589ed23dd27b8 Mikael Pettersson 2008-08-20 156 break;
e589ed23dd27b8 Mikael Pettersson 2008-08-20 157 case FUTEX_OP_XOR:
df77abcafc8dc8 Will Deacon 2011-09-23 158 __futex_atomic_op("eor %0, %1, %4", ret, oldval, tmp, uaddr, oparg);
e589ed23dd27b8 Mikael Pettersson 2008-08-20 159 break;
e589ed23dd27b8 Mikael Pettersson 2008-08-20 160 default:
e589ed23dd27b8 Mikael Pettersson 2008-08-20 161 ret = -ENOSYS;
e589ed23dd27b8 Mikael Pettersson 2008-08-20 162 }
e589ed23dd27b8 Mikael Pettersson 2008-08-20 163

:::::: The code at line 146 was first introduced by commit
:::::: df77abcafc8dc881b6c9347548651777088e4b27 ARM: 7099/1: futex: preserve oldval in SMP __futex_atomic_op

:::::: TO: Will Deacon <will.deacon@xxxxxxx>
:::::: CC: Russell King <rmk+kernel@xxxxxxxxxxxxxxxx>

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