arch/sparc/include/asm/cmpxchg_64.h:161:55: sparse: sparse: cast truncates bits from constant value (eb9f becomes 9f)

From: kernel test robot
Date: Tue Nov 07 2023 - 07:50:41 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: be3ca57cfb777ad820c6659d52e60bbdd36bf5ff
commit: c3c510ce431cd99fa10dcd50d995c8e89330ee5b bpf: Add 'owner' field to bpf_{list,rb}_node
date: 4 months ago
config: sparc64-randconfig-r113-20231107 (https://download.01.org/0day-ci/archive/20231107/202311072039.EqYDv3BV-lkp@xxxxxxxxx/config)
compiler: sparc64-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231107/202311072039.EqYDv3BV-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/202311072039.EqYDv3BV-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
kernel/bpf/helpers.c: note: in included file (through arch/sparc/include/asm/cmpxchg.h, arch/sparc/include/asm/atomic_64.h, arch/sparc/include/asm/atomic.h, ...):
>> arch/sparc/include/asm/cmpxchg_64.h:161:55: sparse: sparse: cast truncates bits from constant value (eb9f becomes 9f)
>> arch/sparc/include/asm/cmpxchg_64.h:161:55: sparse: sparse: cast truncates bits from constant value (eb9f becomes 9f)
kernel/bpf/helpers.c:2419:18: sparse: sparse: context imbalance in 'bpf_rcu_read_lock' - wrong count at exit
kernel/bpf/helpers.c:2424:18: sparse: sparse: context imbalance in 'bpf_rcu_read_unlock' - unexpected unlock

vim +161 arch/sparc/include/asm/cmpxchg_64.h

d550bbd40c0e10 David Howells 2012-03-28 155
d550bbd40c0e10 David Howells 2012-03-28 156 static inline unsigned long
d550bbd40c0e10 David Howells 2012-03-28 157 __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
d550bbd40c0e10 David Howells 2012-03-28 158 {
d550bbd40c0e10 David Howells 2012-03-28 159 switch (size) {
a12ee2349312d7 Babu Moger 2017-05-24 160 case 1:
a12ee2349312d7 Babu Moger 2017-05-24 @161 return __cmpxchg_u8(ptr, old, new);
d550bbd40c0e10 David Howells 2012-03-28 162 case 4:
d550bbd40c0e10 David Howells 2012-03-28 163 return __cmpxchg_u32(ptr, old, new);
d550bbd40c0e10 David Howells 2012-03-28 164 case 8:
d550bbd40c0e10 David Howells 2012-03-28 165 return __cmpxchg_u64(ptr, old, new);
d550bbd40c0e10 David Howells 2012-03-28 166 }
d550bbd40c0e10 David Howells 2012-03-28 167 __cmpxchg_called_with_bad_pointer();
d550bbd40c0e10 David Howells 2012-03-28 168 return old;
d550bbd40c0e10 David Howells 2012-03-28 169 }
d550bbd40c0e10 David Howells 2012-03-28 170

:::::: The code at line 161 was first introduced by commit
:::::: a12ee2349312d7112b9b7c6ac2e70c5ec2ca334e arch/sparc: Introduce cmpxchg_u8 SPARC

:::::: TO: Babu Moger <babu.moger@xxxxxxxxxx>
:::::: CC: David S. Miller <davem@xxxxxxxxxxxxx>

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