include/asm-generic/atomic-instrumented.h:193:29: sparse: sparse: context imbalance in 'dn_socket_seq_next' - unexpected unlock

From: kernel test robot
Date: Wed Sep 02 2020 - 10:40:18 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 9c7d619be5a002ea29c172df5e3c1227c22cbb41
commit: a4654e9bde4ecedb4921e6c8fe2088114bdff1b3 Merge branch 'x86/kdump' into locking/kcsan, to resolve conflicts
date: 6 months ago
config: arm64-randconfig-s031-20200902 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.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.2-191-g10164920-dirty
git checkout a4654e9bde4ecedb4921e6c8fe2088114bdff1b3
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arm64

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


sparse warnings: (new ones prefixed by >>)

net/decnet/af_decnet.c:249:22: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int hash @@ got restricted __le16 [usertype] sdn_objnamel @@
net/decnet/af_decnet.c:249:22: sparse: expected unsigned int hash
net/decnet/af_decnet.c:249:22: sparse: got restricted __le16 [usertype] sdn_objnamel
net/decnet/af_decnet.c: note: in included file:
include/net/dn.h:192:24: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] sport @@ got restricted __le16 [usertype] addrloc @@
include/net/dn.h:192:24: sparse: expected restricted __be16 [usertype] sport
include/net/dn.h:192:24: sparse: got restricted __le16 [usertype] addrloc
include/net/dn.h:193:24: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] dport @@ got restricted __le16 [usertype] addrrem @@
include/net/dn.h:193:24: sparse: expected restricted __be16 [usertype] dport
include/net/dn.h:193:24: sparse: got restricted __le16 [usertype] addrrem
net/decnet/af_decnet.c:2159:13: sparse: sparse: context imbalance in 'dn_socket_get_idx' - wrong count at exit
net/decnet/af_decnet.c: note: in included file (through arch/arm64/include/asm/atomic.h, include/linux/atomic.h, include/asm-generic/bitops/atomic.h, ...):
>> include/asm-generic/atomic-instrumented.h:193:29: sparse: sparse: context imbalance in 'dn_socket_seq_next' - unexpected unlock
>> include/asm-generic/atomic-instrumented.h:193:29: sparse: sparse: context imbalance in 'dn_socket_seq_stop' - unexpected unlock

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a4654e9bde4ecedb4921e6c8fe2088114bdff1b3
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout a4654e9bde4ecedb4921e6c8fe2088114bdff1b3
vim +/dn_socket_seq_next +193 include/asm-generic/atomic-instrumented.h

aa525d063851a9 Mark Rutland 2018-09-04 188
aa525d063851a9 Mark Rutland 2018-09-04 189 #if defined(arch_atomic_sub_return_release)
c020395b6634b7 Marco Elver 2019-11-26 190 static __always_inline int
aa525d063851a9 Mark Rutland 2018-09-04 191 atomic_sub_return_release(int i, atomic_t *v)
aa525d063851a9 Mark Rutland 2018-09-04 192 {
e75a6795ed132f Marco Elver 2019-11-14 @193 __atomic_check_write(v, sizeof(*v));
aa525d063851a9 Mark Rutland 2018-09-04 194 return arch_atomic_sub_return_release(i, v);
aa525d063851a9 Mark Rutland 2018-09-04 195 }
aa525d063851a9 Mark Rutland 2018-09-04 196 #define atomic_sub_return_release atomic_sub_return_release
aa525d063851a9 Mark Rutland 2018-09-04 197 #endif
aa525d063851a9 Mark Rutland 2018-09-04 198

:::::: The code at line 193 was first introduced by commit
:::::: e75a6795ed132f26f69d08dea958630d5993056d locking/atomics, kcsan: Add KCSAN instrumentation

:::::: TO: Marco Elver <elver@xxxxxxxxxx>
:::::: CC: Paul E. McKenney <paulmck@xxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip