arch/parisc/include/asm/cmpxchg.h:75:61: sparse: sparse: cast truncates bits from constant value (e0f510cc becomes cc)

From: kernel test robot
Date: Thu Aug 20 2020 - 21:24:49 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: da2968ff879b9e74688cdc658f646971991d2c56
commit: b344d6a83d01c52fddbefa6b3b4764da5b1022a0 parisc: add support for cmpxchg on u8 pointers
date: 4 weeks ago
config: parisc-randconfig-s032-20200820 (attached as .config)
compiler: hppa-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 b344d6a83d01c52fddbefa6b3b4764da5b1022a0
# 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=parisc

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


sparse warnings: (new ones prefixed by >>)

fs/erofs/utils.c: note: in included file (through arch/parisc/include/asm/atomic.h, include/linux/atomic.h, arch/parisc/include/asm/bitops.h, ...):
>> arch/parisc/include/asm/cmpxchg.h:75:61: sparse: sparse: cast truncates bits from constant value (e0f510cc becomes cc)
--
fs/erofs/zdata.c: note: in included file (through arch/parisc/include/asm/atomic.h, include/linux/atomic.h, arch/parisc/include/asm/bitops.h, ...):
>> arch/parisc/include/asm/cmpxchg.h:75:61: sparse: sparse: cast truncates bits from constant value (e0f510cc becomes cc)
arch/parisc/include/asm/cmpxchg.h:75:52: sparse: sparse: cast truncates bits from constant value (5f0ecafe becomes fe)
arch/parisc/include/asm/cmpxchg.h:75:52: sparse: sparse: cast truncates bits from constant value (5f0ecafe becomes fe)
arch/parisc/include/asm/cmpxchg.h:75:61: sparse: sparse: cast truncates bits from constant value (5f0edead becomes ad)

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b344d6a83d01c52fddbefa6b3b4764da5b1022a0
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout b344d6a83d01c52fddbefa6b3b4764da5b1022a0
vim +75 arch/parisc/include/asm/cmpxchg.h

64
65 /* don't worry...optimizer will get rid of most of this */
66 static inline unsigned long
67 __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size)
68 {
69 switch (size) {
70 #ifdef CONFIG_64BIT
71 case 8: return __cmpxchg_u64((u64 *)ptr, old, new_);
72 #endif
73 case 4: return __cmpxchg_u32((unsigned int *)ptr,
74 (unsigned int)old, (unsigned int)new_);
> 75 case 1: return __cmpxchg_u8((u8 *)ptr, (u8)old, (u8)new_);
76 }
77 __cmpxchg_called_with_bad_pointer();
78 return old;
79 }
80

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

Attachment: .config.gz
Description: application/gzip