[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 000/141] Fix fall-through warnings for Clang
- To: Kees Cook <keescook@xxxxxxxxxxxx>
- From: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
- Date: Mon, 23 Nov 2020 17:32:51 -0800
- Cc: Jakub Kicinski <kuba@xxxxxxxxxx>, "Gustavo A. R. Silva" <gustavoars@xxxxxxxxxx>, LKML <linux-kernel@xxxxxxxxxxxxxxx>, alsa-devel@xxxxxxxxxxxxxxxx, amd-gfx list <amd-gfx@xxxxxxxxxxxxxxxxxxxxx>, bridge@xxxxxxxxxxxxxxxxxxxxxxxxxx, ceph-devel@xxxxxxxxxxxxxxx, cluster-devel@xxxxxxxxxx, coreteam@xxxxxxxxxxxxx, devel@xxxxxxxxxxxxxxxxxxxx, dm-devel@xxxxxxxxxx, drbd-dev@xxxxxxxxxxxxxxxx, dri-devel <dri-devel@xxxxxxxxxxxxxxxxxxxxx>, GR-everest-linux-l2@xxxxxxxxxxx, GR-Linux-NIC-Dev@xxxxxxxxxxx, intel-gfx@xxxxxxxxxxxxxxxxxxxxx, intel-wired-lan@xxxxxxxxxxxxxxxx, keyrings@xxxxxxxxxxxxxxx, linux1394-devel@xxxxxxxxxxxxxxxxxxxxx, linux-acpi@xxxxxxxxxxxxxxx, linux-afs@xxxxxxxxxxxxxxxxxxx, Linux ARM <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, linux-arm-msm <linux-arm-msm@xxxxxxxxxxxxxxx>, linux-atm-general@xxxxxxxxxxxxxxxxxxxxx, linux-block@xxxxxxxxxxxxxxx, linux-can@xxxxxxxxxxxxxxx, linux-cifs@xxxxxxxxxxxxxxx, "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" <linux-crypto@xxxxxxxxxxxxxxx>, linux-decnet-user@xxxxxxxxxxxxxxxxxxxxx, linux-ext4@xxxxxxxxxxxxxxx, linux-fbdev@xxxxxxxxxxxxxxx, linux-geode@xxxxxxxxxxxxxxxxxxx, linux-gpio@xxxxxxxxxxxxxxx, linux-hams@xxxxxxxxxxxxxxx, linux-hwmon@xxxxxxxxxxxxxxx, linux-i3c@xxxxxxxxxxxxxxxxxxx, linux-ide@xxxxxxxxxxxxxxx, linux-iio@xxxxxxxxxxxxxxx, linux-input@xxxxxxxxxxxxxxx, linux-integrity@xxxxxxxxxxxxxxx, linux-mediatek@xxxxxxxxxxxxxxxxxxx, linux-media@xxxxxxxxxxxxxxx, linux-mmc@xxxxxxxxxxxxxxx, Linux Memory Management List <linux-mm@xxxxxxxxx>, linux-mtd@xxxxxxxxxxxxxxxxxxx, linux-nfs@xxxxxxxxxxxxxxx, linux-rdma@xxxxxxxxxxxxxxx, Linux-Renesas <linux-renesas-soc@xxxxxxxxxxxxxxx>, linux-scsi@xxxxxxxxxxxxxxx, linux-sctp@xxxxxxxxxxxxxxx, linux-security-module@xxxxxxxxxxxxxxx, linux-stm32@xxxxxxxxxxxxxxxxxxxxxxxxxxxx, linux-usb@xxxxxxxxxxxxxxx, linux-watchdog@xxxxxxxxxxxxxxx, linux-wireless <linux-wireless@xxxxxxxxxxxxxxx>, Network Development <netdev@xxxxxxxxxxxxxxx>, netfilter-devel@xxxxxxxxxxxxxxx, nouveau@xxxxxxxxxxxxxxxxxxxxx, op-tee@xxxxxxxxxxxxxxxxxxxxxxxxx, oss-drivers@xxxxxxxxxxxxx, patches@xxxxxxxxxxxxxxxxxxxxx, rds-devel@xxxxxxxxxxxxxx, reiserfs-devel@xxxxxxxxxxxxxxx, samba-technical@xxxxxxxxxxxxxxx, selinux@xxxxxxxxxxxxxxx, target-devel@xxxxxxxxxxxxxxx, tipc-discussion@xxxxxxxxxxxxxxxxxxxxx, usb-storage@xxxxxxxxxxxxxxxxxxxxxxxx, virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx, wcn36xx@xxxxxxxxxxxxxxxxxxx, "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, linux-hardening@xxxxxxxxxxxxxxx, Nathan Chancellor <natechancellor@xxxxxxxxx>, Miguel Ojeda <ojeda@xxxxxxxxxx>, Joe Perches <joe@xxxxxxxxxxx>
- Delivery-date: Tue, 24 Nov 2020 01:33:15 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Sun, Nov 22, 2020 at 8:17 AM Kees Cook <keescook@xxxxxxxxxxxx> wrote:
>
> On Fri, Nov 20, 2020 at 11:51:42AM -0800, Jakub Kicinski wrote:
> > 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@xxxxxxxxxxxxxx/
So looks like the bulk of these are:
switch (x) {
case 0:
++x;
default:
break;
}
I have a patch that fixes those up for clang:
https://reviews.llvm.org/D91895
There's 3 other cases that don't quite match between GCC and Clang I
observe in the kernel:
switch (x) {
case 0:
++x;
default:
goto y;
}
y:;
switch (x) {
case 0:
++x;
default:
return;
}
switch (x) {
case 0:
++x;
default:
;
}
Based on your link, and Nathan's comment on my patch, maybe Clang
should continue to warn for the above (at least the `default: return;`
case) and GCC should change? While the last case looks harmless,
there were only 1 or 2 across the tree in my limited configuration
testing; I really think we should just add `break`s for those.
--
Thanks,
~Nick Desaulniers
|