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:   Thu, 21 Apr 2022 16:18:14 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Randy Dunlap <rdunlap@...radead.org>,
        Naresh Kamboju <naresh.kamboju@...aro.org>,
        Linux-Next Mailing List <linux-next@...r.kernel.org>,
        open list <linux-kernel@...r.kernel.org>,
        lkft-triage@...ts.linaro.org, linux-usb@...r.kernel.org
Cc:     Stephen Rothwell <sfr@...b.auug.org.au>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        heikki.krogerus@...ux.intel.com
Subject: Re: drivers/usb/typec/tcpm/tcpm.c:4724:3: error: case label does not
 reduce to an integer constant

On 4/21/22 15:27, Randy Dunlap wrote:
> Hi--
> 
> On 4/21/22 13:36, Guenter Roeck wrote:
>> On 4/21/22 12:03, Naresh Kamboju wrote:
>>> Linux mainline and linux next arm64 builds failed with gcc-7.3.x.
>>>
>>> drivers/usb/typec/tcpm/tcpm.c: In function 'run_state_machine':
>>> drivers/usb/typec/tcpm/tcpm.c:4724:3: error: case label does not
>>> reduce to an integer constant
>>>      case BDO_MODE_TESTDATA:
>>>      ^~~~
>>> make[4]: *** [scripts/Makefile.build:288: drivers/usb/typec/tcpm/tcpm.o] Error 1
>>>                                         ^
>>> Reported-by: Linux Kernel Functional Testing <lkft@...aro.org>
>>>
>>> -- 
>>
>> That code is several years old, the define is a constant, and I don't see
>> a recent change in the code. What am I missing ?
> 
> See a recent patch for the same problem in a different area:
> 
> commit 1ef8715975de
> Author: Borislav Petkov <bp@...e.de>
> Date:   Tue Apr 5 17:15:08 2022 +0200
> 
>      ALSA: usb-audio: Fix undefined behavior due to shift overflowing the constant
> 
> so those constants probably need to be cast to unsigned int.
> (I guess)
> 

Turns out other versions of gcc are "affected" as well.

$ cc -Wall -std=c11 -pedantic -pedantic-errors testc.c
testc.c: In function ‘main’:
testc.c:16:2: error: case label is not an integer constant expression [-Wpedantic]
    16 |  case BDO_MODE_TESTDATA:
       |  ^~~~

... but _only_ with "-std=c11 -pedantic -pedantic-errors" or with "-fsanitize=shift".

It wants
	#define BDO_MODE_TESTDATA	(8u << 28)

Pedantic indeed ...

Guenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ