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-prev] [day] [month] [year] [list]
Date:   Wed, 1 Sep 2021 15:20:47 +0200
From:   Christophe Leroy <christophe.leroy@...roup.eu>
To:     kernel test robot <lkp@...el.com>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org, Michael Ellerman <mpe@...erman.id.au>
Subject: Re: [linuxppc:next-test 71/141]
 drivers/net/ethernet/sfc/falcon/farch.c:994:10: warning: shift count is
 negative



Le 01/09/2021 à 04:54, kernel test robot a écrit :
> tree:   https://github.com/linuxppc/linux next-test
> head:   c7dee506ec3450717e84518ab3a6a3f2ce755cf6
> commit: 1e688dd2a3d6759d416616ff07afc4bb836c4213 [71/141] powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with asm goto
> config: powerpc-randconfig-r031-20210901 (attached as .config)
> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 4b1fde8a2b681dad2ce0c082a5d6422caa06b0bc)

Apparently a clang problem. This doesn't happen with GCC.


> reproduce (this is a W=1 build):
>          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>          chmod +x ~/bin/make.cross
>          # install powerpc cross compiling tool for clang build
>          # apt-get install binutils-powerpc64-linux-gnu
>          # https://github.com/linuxppc/linux/commit/1e688dd2a3d6759d416616ff07afc4bb836c4213
>          git remote add linuxppc https://github.com/linuxppc/linux
>          git fetch --no-tags linuxppc next-test
>          git checkout 1e688dd2a3d6759d416616ff07afc4bb836c4213
>          # save the attached .config to linux build tree
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@...el.com>
> 
> All warnings (new ones prefixed by >>):
> 
>>> drivers/net/ethernet/sfc/falcon/farch.c:994:10: warning: shift count is negative [-Wshift-count-negative]
>             WARN_ON(EF4_QWORD_FIELD(*event, FSF_AZ_RX_EV_Q_LABEL) !=
>             ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>     drivers/net/ethernet/sfc/falcon/bitfield.h:222:26: note: expanded from macro 'EF4_QWORD_FIELD'
>     #define EF4_QWORD_FIELD         EF4_QWORD_FIELD64
>                                     ^
>     drivers/net/ethernet/sfc/falcon/bitfield.h:173:2: note: expanded from macro 'EF4_QWORD_FIELD64'
>             EF4_EXTRACT_QWORD64(qword, EF4_LOW_BIT(field),          \
>             ^
>     drivers/net/ethernet/sfc/falcon/bitfield.h:149:3: note: expanded from macro 'EF4_EXTRACT_QWORD64'
>             (EF4_EXTRACT64((qword).u64[0], 0, 63, low, high) &              \
>              ^
>     note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
>     arch/powerpc/include/asm/bug.h:122:30: note: expanded from macro 'WARN_ON'
>                                        __label_warn_on, "r" (x));   \
>                                        ~~~~~~~~~~~~~~~~~~~~~~^~~
>     arch/powerpc/include/asm/bug.h:75:7: note: expanded from macro 'WARN_ENTRY'
>                       ##__VA_ARGS__ : : label)
>                       ~~^~~~~~~~~~~~~~~~~~~~~~
>     include/linux/compiler_types.h:254:42: note: expanded from macro 'asm_volatile_goto'
>     #define asm_volatile_goto(x...) asm goto(x)
>                                              ^
>     1 warning generated.


Complete with -fmacro-backtrace-limit=0 :

   CC      drivers/net/ethernet/sfc/falcon/farch.o
drivers/net/ethernet/sfc/falcon/farch.c:994:10: warning: shift count is 
negative [-Wshift-count-negative]
         WARN_ON(EF4_QWORD_FIELD(*event, FSF_AZ_RX_EV_Q_LABEL) !=
         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/sfc/falcon/bitfield.h:222:26: note: expanded from 
macro 'EF4_QWORD_FIELD'
#define EF4_QWORD_FIELD         EF4_QWORD_FIELD64
                                 ^
drivers/net/ethernet/sfc/falcon/bitfield.h:173:2: note: expanded from 
macro 'EF4_QWORD_FIELD64'
         EF4_EXTRACT_QWORD64(qword, EF4_LOW_BIT(field),          \
         ^
drivers/net/ethernet/sfc/falcon/bitfield.h:149:3: note: expanded from 
macro 'EF4_EXTRACT_QWORD64'
         (EF4_EXTRACT64((qword).u64[0], 0, 63, low, high) &              \
          ^
drivers/net/ethernet/sfc/falcon/bitfield.h:134:2: note: expanded from 
macro 'EF4_EXTRACT64'
         EF4_EXTRACT_NATIVE(le64_to_cpu(element), min, max, low, high)
         ^
drivers/net/ethernet/sfc/falcon/bitfield.h:127:20: note: expanded from 
macro 'EF4_EXTRACT_NATIVE'
          (native_element) << ((min) - (low)))
                           ^
./arch/powerpc/include/asm/bug.h:122:30: note: expanded from macro 'WARN_ON'
                                    __label_warn_on, "r" (x));   \
                                    ~~~~~~~~~~~~~~~~~~~~~~^~~
./arch/powerpc/include/asm/bug.h:75:7: note: expanded from macro 
'WARN_ENTRY'
                   ##__VA_ARGS__ : : label)
                   ~~^~~~~~~~~~~~~~~~~~~~~~
./include/linux/compiler_types.h:254:42: note: expanded from macro 
'asm_volatile_goto'
#define asm_volatile_goto(x...) asm goto(x)
                                          ^
1 warning generated.



The warning makes no sense because this part of the macro is as follows 
so there is no way the shift can be negative.

	 (low) > (min) ?					\
	 (native_element) >> ((low) - (min)) :			\
	 (native_element) << ((min) - (low)))


Christophe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ