Mailing List Archive

[tip:locking/rcuref 2/2] arch/alpha/include/asm/xchg.h:234:32: sparse: sparse: cast truncates bits from constant value (ffffffffe0000000 becomes 0)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking/rcuref
head: ee1ee6db07795d9637bc5e8993a8ddcf886541ef
commit: ee1ee6db07795d9637bc5e8993a8ddcf886541ef [2/2] atomics: Provide rcuref - scalable reference counting
config: alpha-randconfig-s052-20230329 (https://download.01.org/0day-ci/archive/20230330/202303300857.c20wTtqR-lkp@intel.com/config)
compiler: alpha-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/tip/tip.git/commit/?id=ee1ee6db07795d9637bc5e8993a8ddcf886541ef
git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
git fetch --no-tags tip locking/rcuref
git checkout ee1ee6db07795d9637bc5e8993a8ddcf886541ef
# 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=alpha 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=alpha SHELL=/bin/bash

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

sparse warnings: (new ones prefixed by >>)
lib/rcuref.c: note: in included file (through arch/alpha/include/asm/cmpxchg.h, arch/alpha/include/asm/atomic.h, include/linux/atomic.h, ...):
>> arch/alpha/include/asm/xchg.h:234:32: sparse: sparse: cast truncates bits from constant value (ffffffffe0000000 becomes 0)
arch/alpha/include/asm/xchg.h:236:32: sparse: sparse: cast truncates bits from constant value (ffffffffe0000000 becomes 0)

vim +234 arch/alpha/include/asm/xchg.h

a6209d6d71f2ab Ivan Kokshaysky 2009-03-31 227
a6209d6d71f2ab Ivan Kokshaysky 2009-03-31 228 static __always_inline unsigned long
a6209d6d71f2ab Ivan Kokshaysky 2009-03-31 229 ____cmpxchg(, volatile void *ptr, unsigned long old, unsigned long new,
a6209d6d71f2ab Ivan Kokshaysky 2009-03-31 230 int size)
a6209d6d71f2ab Ivan Kokshaysky 2009-03-31 231 {
a6209d6d71f2ab Ivan Kokshaysky 2009-03-31 232 switch (size) {
a6209d6d71f2ab Ivan Kokshaysky 2009-03-31 233 case 1:
a6209d6d71f2ab Ivan Kokshaysky 2009-03-31 @234 return ____cmpxchg(_u8, ptr, old, new);
a6209d6d71f2ab Ivan Kokshaysky 2009-03-31 235 case 2:
a6209d6d71f2ab Ivan Kokshaysky 2009-03-31 236 return ____cmpxchg(_u16, ptr, old, new);
a6209d6d71f2ab Ivan Kokshaysky 2009-03-31 237 case 4:
a6209d6d71f2ab Ivan Kokshaysky 2009-03-31 238 return ____cmpxchg(_u32, ptr, old, new);
a6209d6d71f2ab Ivan Kokshaysky 2009-03-31 239 case 8:
a6209d6d71f2ab Ivan Kokshaysky 2009-03-31 240 return ____cmpxchg(_u64, ptr, old, new);
a6209d6d71f2ab Ivan Kokshaysky 2009-03-31 241 }
a6209d6d71f2ab Ivan Kokshaysky 2009-03-31 242 __cmpxchg_called_with_bad_pointer();
a6209d6d71f2ab Ivan Kokshaysky 2009-03-31 243 return old;
a6209d6d71f2ab Ivan Kokshaysky 2009-03-31 244 }
a6209d6d71f2ab Ivan Kokshaysky 2009-03-31 245

:::::: The code at line 234 was first introduced by commit
:::::: a6209d6d71f2ab8c63cc1587ef65490d83022baf alpha: xchg/cmpxchg cleanup and fixes

:::::: TO: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

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