lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <202111240654.4qXNBmtC-lkp@intel.com>
Date:   Wed, 24 Nov 2021 06:19:48 +0800
From:   kernel test robot <lkp@...el.com>
To:     Mark Rutland <mark.rutland@....com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Peter Zijlstra <peterz@...radead.org>
Subject: include/asm-generic/cmpxchg.h:37:39: sparse: sparse: cast truncates
 bits from constant value (deadbeef becomes ef)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   136057256686de39cc3a07c2e39ef6bc43003ff6
commit: c7178cdecdbef8321f418fac55f3afaca3bb4c96 locking/atomic: h8300: use asm-generic exclusively
date:   6 months ago
config: h8300-randconfig-s031-20211117 (https://download.01.org/0day-ci/archive/20211124/202111240654.4qXNBmtC-lkp@intel.com/config.gz)
compiler: h8300-linux-gcc (GCC) 11.2.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-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c7178cdecdbef8321f418fac55f3afaca3bb4c96
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout c7178cdecdbef8321f418fac55f3afaca3bb4c96
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=h8300 SHELL=/bin/bash

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


sparse warnings: (new ones prefixed by >>)
   lib/atomic64_test.c: note: in included file (through arch/h8300/include/generated/asm/cmpxchg.h, include/asm-generic/atomic.h, arch/h8300/include/generated/asm/atomic.h, ...):
>> include/asm-generic/cmpxchg.h:37:39: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg.h:48:40: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg.h:37:39: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg.h:48:40: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg.h:37:39: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg.h:48:40: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg.h:37:39: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg.h:48:40: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
   lib/atomic64_test.c: note: in included file (through include/asm-generic/cmpxchg.h, arch/h8300/include/generated/asm/cmpxchg.h, include/asm-generic/atomic.h, ...):
>> include/asm-generic/cmpxchg-local.h:30:42: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg-local.h:34:44: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg-local.h:30:42: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg-local.h:34:44: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg-local.h:30:42: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg-local.h:34:44: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg-local.h:30:42: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg-local.h:34:44: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg-local.h:30:42: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg-local.h:34:44: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg-local.h:30:42: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg-local.h:34:44: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg-local.h:30:42: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg-local.h:34:44: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg-local.h:30:42: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg-local.h:34:44: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)

vim +37 include/asm-generic/cmpxchg.h

b4816afa398670 David Howells 2012-03-28  24  
b4816afa398670 David Howells 2012-03-28  25  static inline
b4816afa398670 David Howells 2012-03-28  26  unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
b4816afa398670 David Howells 2012-03-28  27  {
b4816afa398670 David Howells 2012-03-28  28  	unsigned long ret, flags;
b4816afa398670 David Howells 2012-03-28  29  
b4816afa398670 David Howells 2012-03-28  30  	switch (size) {
b4816afa398670 David Howells 2012-03-28  31  	case 1:
b4816afa398670 David Howells 2012-03-28  32  #ifdef __xchg_u8
b4816afa398670 David Howells 2012-03-28  33  		return __xchg_u8(x, ptr);
b4816afa398670 David Howells 2012-03-28  34  #else
b4816afa398670 David Howells 2012-03-28  35  		local_irq_save(flags);
b4816afa398670 David Howells 2012-03-28  36  		ret = *(volatile u8 *)ptr;
b4816afa398670 David Howells 2012-03-28 @37  		*(volatile u8 *)ptr = x;
b4816afa398670 David Howells 2012-03-28  38  		local_irq_restore(flags);
b4816afa398670 David Howells 2012-03-28  39  		return ret;
b4816afa398670 David Howells 2012-03-28  40  #endif /* __xchg_u8 */
b4816afa398670 David Howells 2012-03-28  41  
b4816afa398670 David Howells 2012-03-28  42  	case 2:
b4816afa398670 David Howells 2012-03-28  43  #ifdef __xchg_u16
b4816afa398670 David Howells 2012-03-28  44  		return __xchg_u16(x, ptr);
b4816afa398670 David Howells 2012-03-28  45  #else
b4816afa398670 David Howells 2012-03-28  46  		local_irq_save(flags);
b4816afa398670 David Howells 2012-03-28  47  		ret = *(volatile u16 *)ptr;
b4816afa398670 David Howells 2012-03-28 @48  		*(volatile u16 *)ptr = x;
b4816afa398670 David Howells 2012-03-28  49  		local_irq_restore(flags);
b4816afa398670 David Howells 2012-03-28  50  		return ret;
b4816afa398670 David Howells 2012-03-28  51  #endif /* __xchg_u16 */
b4816afa398670 David Howells 2012-03-28  52  
b4816afa398670 David Howells 2012-03-28  53  	case 4:
b4816afa398670 David Howells 2012-03-28  54  #ifdef __xchg_u32
b4816afa398670 David Howells 2012-03-28  55  		return __xchg_u32(x, ptr);
b4816afa398670 David Howells 2012-03-28  56  #else
b4816afa398670 David Howells 2012-03-28  57  		local_irq_save(flags);
b4816afa398670 David Howells 2012-03-28  58  		ret = *(volatile u32 *)ptr;
b4816afa398670 David Howells 2012-03-28  59  		*(volatile u32 *)ptr = x;
b4816afa398670 David Howells 2012-03-28  60  		local_irq_restore(flags);
b4816afa398670 David Howells 2012-03-28  61  		return ret;
b4816afa398670 David Howells 2012-03-28  62  #endif /* __xchg_u32 */
b4816afa398670 David Howells 2012-03-28  63  

:::::: The code at line 37 was first introduced by commit
:::::: b4816afa3986704d1404fc48e931da5135820472 Move the asm-generic/system.h xchg() implementation to asm-generic/cmpxchg.h

:::::: TO: David Howells <dhowells@...hat.com>
:::::: CC: David Howells <dhowells@...hat.com>

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ