From: Kees Cook <keescook@chromium.org>
To: op-tee@lists.trustedfirmware.org
Subject: Re: [PATCH 000/141] Fix fall-through warnings for Clang
Date: Sun, 22 Nov 2020 08:17:03 -0800 [thread overview]
Message-ID: <202011220816.8B6591A@keescook> (raw)
In-Reply-To: < <20201120115142.292999b2@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>>
[-- Attachment #1: Type: text/plain, Size: 2010 bytes --]
On Fri, Nov 20, 2020 at 11:51:42AM -0800, Jakub Kicinski wrote:
> On Fri, 20 Nov 2020 11:30:40 -0800 Kees Cook wrote:
> > On Fri, Nov 20, 2020 at 10:53:44AM -0800, Jakub Kicinski wrote:
> > > On Fri, 20 Nov 2020 12:21:39 -0600 Gustavo A. R. Silva wrote:
> > > > This series aims to fix almost all remaining fall-through warnings in
> > > > order to enable -Wimplicit-fallthrough for Clang.
> > > >
> > > > In preparation to enable -Wimplicit-fallthrough for Clang, explicitly
> > > > add multiple break/goto/return/fallthrough statements instead of just
> > > > letting the code fall through to the next case.
> > > >
> > > > Notice that in order to enable -Wimplicit-fallthrough for Clang, this
> > > > change[1] is meant to be reverted at some point. So, this patch helps
> > > > to move in that direction.
> > > >
> > > > Something important to mention is that there is currently a discrepancy
> > > > between GCC and Clang when dealing with switch fall-through to empty case
> > > > statements or to cases that only contain a break/continue/return
> > > > statement[2][3][4].
> > >
> > > Are we sure we want to make this change? Was it discussed before?
> > >
> > > Are there any bugs Clangs puritanical definition of fallthrough helped
> > > find?
> > >
> > > IMVHO compiler warnings are supposed to warn about issues that could
> > > be bugs. Falling through to default: break; can hardly be a bug?!
> >
> > It's certainly a place where the intent is not always clear. I think
> > this makes all the cases unambiguous, and doesn't impact the machine
> > code, since the compiler will happily optimize away any behavioral
> > redundancy.
>
> If none of the 140 patches here fix a real bug, and there is no change
> to machine code then it sounds to me like a W=2 kind of a warning.
FWIW, this series has found at least one bug so far:
https://lore.kernel.org/lkml/CAFCwf11izHF=g1mGry1fE5kvFFFrxzhPSM6qKAO8gxSp=Kr_CQ(a)mail.gmail.com/
--
Kees Cook
next prev parent reply other threads:[~2020-11-22 16:17 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] < <20201120115142.292999b2@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
2020-11-20 20:48 ` [PATCH 000/141] Fix fall-through warnings for Clang Kees Cook
2020-11-22 16:17 ` Kees Cook [this message]
2020-11-22 18:21 ` James Bottomley
2020-11-24 1:32 ` Nick Desaulniers
2020-12-01 14:04 ` Dan Carpenter
[not found] < <CAMuHMdV5kOakvZJMWLxbpigFPS+Xuw6DVYsWCWZy7wGsv3idcw@mail.gmail.com>
2020-11-26 16:18 ` Karol Herbst
2020-11-26 17:05 ` Miguel Ojeda
[not found] < <CANiq72nobq=ptWK-qWxU91JHqkKhMcRtJNnw2XJd5-vSJWZd8Q@mail.gmail.com>
2020-11-26 15:28 ` Geert Uytterhoeven
[not found] < <CANiq72kqO=bYMJnFS2uYRpgWATJ=uXxZuNUsTXT+3aLtrpnzvQ@mail.gmail.com>
2020-11-25 22:44 ` Edward Cree
2020-11-26 14:53 ` Miguel Ojeda
[not found] < <fc45750b6d0277c401015b7aa11e16cd15f32ab2.camel@HansenPartnership.com>
2020-11-23 16:24 ` Rafael J. Wysocki
2020-11-23 16:32 ` Joe Perches
2020-11-23 18:56 ` Miguel Ojeda
2020-11-25 9:01 ` Sean Young
[not found] < <4993259d01a0064f8bb22770503490f9252f3659.camel@HansenPartnership.com>
2020-11-25 0:32 ` Miguel Ojeda
2020-11-25 10:38 ` Andy Shevchenko
[not found] < <CAKwvOdntVfXj2WRR5n6Kw7BfG7FdKpTeHeh5nPu5AzwVMhOHTg@mail.gmail.com>
2020-11-24 1:46 ` Jakub Kicinski
2020-11-24 21:25 ` Kees Cook
2020-11-25 23:02 ` Edward Cree
2020-12-01 14:08 ` Dan Carpenter
[not found] < <CANiq72=z+tmuey9wj3Kk7wX5s0hTHpsQdLhAqcOVNrHon6xn5Q@mail.gmail.com>
2020-11-24 0:58 ` Finn Thain
2020-11-24 1:05 ` Joe Perches
2020-11-24 2:48 ` Finn Thain
2020-11-24 23:46 ` Miguel Ojeda
[not found] < <CANiq72k5tpDoDPmJ0ZWc1DGqm+81Gi-uEENAtvEs9v3SZcx6_Q@mail.gmail.com>
2020-11-23 20:37 ` James Bottomley
[not found] < <CANiq72m22Jb5_+62NnwX8xds2iUdWDMAqD8PZw9cuxdHd95W0A@mail.gmail.com>
2020-11-23 15:58 ` James Bottomley
[not found] < <1c7d7fde126bc0acf825766de64bf2f9b888f216.camel@HansenPartnership.com>
2020-11-23 14:19 ` Miguel Ojeda
[not found] < <CANiq72nZrHWTA4_Msg6MP9snTyenC6-eGfD27CyfNSu7QoVZbw@mail.gmail.com>
2020-11-22 22:36 ` James Bottomley
2020-11-22 22:54 ` Finn Thain
2020-11-22 23:04 ` James Bottomley
2020-11-23 14:05 ` Miguel Ojeda
[not found] < <0147972a72bc13f3629de8a32dee6f1f308994b5.camel@HansenPartnership.com>
2020-11-22 19:22 ` Joe Perches
2020-11-22 19:53 ` James Bottomley
[not found] < <9b57fd4914b46f38d54087d75e072d6e947cb56d.camel@HansenPartnership.com>
2020-11-22 18:25 ` Joe Perches
2020-11-22 19:12 ` James Bottomley
2020-11-22 20:35 ` Miguel Ojeda
2020-11-22 22:10 ` Sam Ravnborg
[not found] < <20201120105344.4345c14e@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
2020-11-20 19:04 ` Gustavo A. R. Silva
2020-11-20 19:30 ` Kees Cook
2020-11-20 19:51 ` Jakub Kicinski
2020-11-20 18:21 Gustavo A. R. Silva
2020-11-20 18:28 ` Joe Perches
2020-11-20 19:02 ` Gustavo A. R. Silva
2020-11-20 18:53 ` Jakub Kicinski
2020-11-20 22:21 ` Miguel Ojeda
2020-11-23 20:03 ` Jason Gunthorpe
2020-11-24 14:47 ` Gustavo A. R. Silva
2020-11-23 20:38 ` Mark Brown
2020-11-24 14:47 ` Gustavo A. R. Silva
2020-12-01 5:52 ` Martin K. Petersen
2020-12-01 8:20 ` Gustavo A. R. Silva
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202011220816.8B6591A@keescook \
--to=keescook@chromium.org \
--cc=op-tee@lists.trustedfirmware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox