Re: [PATCH] ACPI/IORT: Fix GCC 12 warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 10 Feb 2022 at 20:29, Ard Biesheuvel <ardb@xxxxxxxxxx> wrote:
>
> (cc Kees)
>

... for real this time :-)

> On Thu, 10 Feb 2022 at 18:36, Victor Erminpour
> <victor.erminpour@xxxxxxxxxx> wrote:
> >
> >
> > On 2/10/22 1:11 AM, Ard Biesheuvel wrote:
> > > On Thu, 10 Feb 2022 at 01:34, Victor Erminpour
> > > <victor.erminpour@xxxxxxxxxx> wrote:
> > >> When building with automatic stack variable initialization, GCC 12
> > >> complains about variables defined outside of switch case statements.
> > >> Move the variable into the case that uses it, which silences the warning:
> > >>
> > >> ./drivers/acpi/arm64/iort.c:1670:59: error: statement will never be executed [-Werror=switch-unreachable]
> > >>    1670 |                         struct acpi_iort_named_component *ncomp;
> > >>         |                                                           ^~~~~
> > >>
> > >> Signed-off-by: Victor Erminpour <victor.erminpour@xxxxxxxxxx>
> > > GCC 12 is not released yet, and this is clearly a compiler bug (a
> > > declaration is not a statement, and the hidden offending statement
> > > [the zero-init] is emitted by the compiler itself), so please report
> > > this to the GCC folks instead.
> >
> > Hi Ard,
> >
> > Thanks for the reply.
> > This fix is similar to the following commits that have been integrated
> > upstream:
> > https://lore.kernel.org/linux-hardening/20211209043456.1377875-1-keescook@xxxxxxxxxxxx/
> > https://lore.kernel.org/linux-hardening/20211209043915.1378393-1-keescook@xxxxxxxxxxxx/
> >
>
> If GCC 12 rejects valid C with this feature enabled, the compiler is
> broken and needs to be fixed. Papering over this by making changes to
> perfectly valid C code is a slippery slope that we should avoid.
>
> Since GCC 12 is not released yet, there is time to get this fixed properly.
>
> > You're not obligated to integrate this commit,
>
> Why, thank you :-)
>
> > but you may run into this
> > issue once
> > upstream starts using GCC 12 (or a patched version of GCC 11 in my case)
> > with the
> > CONFIG_INIT_STACK_ALL_ZERO option enabled.
> >
>
> Yes, that part was perfectly clear.



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux