* Re: [PATCH 000/141] Fix fall-through warnings for Clang [not found] <cover.1605896059.git.gustavoars@kernel.org> @ 2020-11-20 18:28 ` Joe Perches 2020-11-20 19:02 ` Gustavo A. R. Silva [not found] ` <20201120105344.4345c14e@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> ` (5 subsequent siblings) 6 siblings, 1 reply; 39+ messages in thread From: Joe Perches @ 2020-11-20 18:28 UTC (permalink / raw) To: Gustavo A. R. Silva, linux-kernel Cc: alsa-devel, linux-atm-general, reiserfs-devel, linux-iio, linux-wireless, linux-fbdev, dri-devel, virtualization, Nathan Chancellor, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, samba-technical, linux-i3c, linux1394-devel, linux-afs, usb-storage, drbd-dev, devel, linux-cifs, rds-devel, Nick Desaulniers, linux-scsi, linux-rdma, oss-drivers, bridge, amd-gfx, linux-stm32, cluster-devel, linux-acpi, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, tipc-discussion, linux-ext4, linux-media, linux-watchdog, selinux, linux-arm-msm, intel-gfx, linux-geode, linux-can, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, ceph-devel, linux-arm-kernel, linux-hwmon, x86, linux-nfs, GR-Linux-NIC-Dev, Kees Cook, linux-mm, netdev, linux-decnet-user, linux-mmc, linux-sctp, linux-renesas-soc, linux-security-module, linux-usb, netfilter-devel, linux-crypto, patches, linux-integrity, target-devel, linux-hardening On Fri, 2020-11-20 at 12:21 -0600, Gustavo A. R. Silva wrote: > Hi all, > > 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. This was a bit hard to parse for a second or three. Thanks Gustavo. How was this change done? _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 000/141] Fix fall-through warnings for Clang 2020-11-20 18:28 ` [PATCH 000/141] Fix fall-through warnings for Clang Joe Perches @ 2020-11-20 19:02 ` Gustavo A. R. Silva 0 siblings, 0 replies; 39+ messages in thread From: Gustavo A. R. Silva @ 2020-11-20 19:02 UTC (permalink / raw) To: Joe Perches, Gustavo A. R. Silva, linux-kernel Cc: alsa-devel, linux-atm-general, reiserfs-devel, linux-iio, linux-wireless, linux-fbdev, dri-devel, virtualization, Nathan Chancellor, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, samba-technical, linux-i3c, linux1394-devel, linux-afs, usb-storage, drbd-dev, devel, linux-cifs, rds-devel, Nick Desaulniers, linux-scsi, linux-rdma, oss-drivers, bridge, amd-gfx, linux-stm32, cluster-devel, linux-acpi, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, tipc-discussion, linux-ext4, linux-media, linux-watchdog, selinux, linux-arm-msm, intel-gfx, linux-geode, linux-can, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, ceph-devel, linux-arm-kernel, linux-hwmon, x86, linux-nfs, GR-Linux-NIC-Dev, Kees Cook, linux-mm, netdev, linux-decnet-user, linux-mmc, linux-sctp, linux-renesas-soc, linux-security-module, linux-usb, netfilter-devel, linux-crypto, patches, linux-integrity, target-devel, linux-hardening On 11/20/20 12:28, Joe Perches wrote: > On Fri, 2020-11-20 at 12:21 -0600, Gustavo A. R. Silva wrote: >> Hi all, >> >> 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. > > This was a bit hard to parse for a second or three. > > Thanks Gustavo. > > How was this change done? I audited case by case in order to determine the best fit for each situation. Depending on the surrounding logic, sometimes it makes more sense a goto or a fallthrough rather than merely a break. Thanks -- Gustavo _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
[parent not found: <20201120105344.4345c14e@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>]
* Re: [PATCH 000/141] Fix fall-through warnings for Clang [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 1 sibling, 0 replies; 39+ messages in thread From: Gustavo A. R. Silva @ 2020-11-20 19:04 UTC (permalink / raw) To: Jakub Kicinski, Gustavo A. R. Silva Cc: alsa-devel, linux-atm-general, reiserfs-devel, linux-iio, linux-wireless, linux-fbdev, dri-devel, virtualization, Nathan Chancellor, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, samba-technical, linux-i3c, linux1394-devel, linux-afs, usb-storage, drbd-dev, devel, linux-cifs, rds-devel, Nick Desaulniers, linux-scsi, linux-rdma, oss-drivers, bridge, linux-security-module, amd-gfx, linux-stm32, cluster-devel, linux-acpi, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, tipc-discussion, linux-ext4, linux-media, linux-watchdog, selinux, linux-arm-msm, intel-gfx, linux-geode, linux-can, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, ceph-devel, linux-arm-kernel, linux-hwmon, x86, linux-nfs, GR-Linux-NIC-Dev, Kees Cook, linux-mm, netdev, linux-decnet-user, linux-mmc, linux-kernel, linux-renesas-soc, linux-sctp, linux-usb, netfilter-devel, linux-crypto, patches, Joe Perches, linux-integrity, target-devel, linux-hardening Hi, On 11/20/20 12:53, 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?! The justification for this is explained in this same changelog text: Now that the -Wimplicit-fallthrough option has been globally enabled[5], any compiler should really warn on missing either a fallthrough annotation or any of the other case-terminating statements (break/continue/return/ goto) when falling through to the next case statement. Making exceptions to this introduces variation in case handling which may continue to lead to bugs, misunderstandings, and a general lack of robustness. The point of enabling options like -Wimplicit-fallthrough is to prevent human error and aid developers in spotting bugs before their code is even built/ submitted/committed, therefore eliminating classes of bugs. So, in order to really accomplish this, we should, and can, move in the direction of addressing any error-prone scenarios and get rid of the unintentional fallthrough bug-class in the kernel, entirely, even if there is some minor redundancy. Better to have explicit case-ending statements than continue to have exceptions where one must guess as to the right result. The compiler will eliminate any actual redundancy. Note that there is already a patch in mainline that addresses almost 40,000 of these issues[6]. [1] commit e2079e93f562c ("kbuild: Do not enable -Wimplicit-fallthrough for clang for now") [2] ClangBuiltLinux#636 [3] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91432 [4] https://godbolt.org/z/xgkvIh [5] commit a035d552a93b ("Makefile: Globally enable fall-through warning") [6] commit 4169e889e588 ("include: jhash/signal: Fix fall-through warnings for Clang") Thanks -- Gustavo _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 000/141] Fix fall-through warnings for Clang [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 [not found] ` <20201120115142.292999b2@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> 1 sibling, 1 reply; 39+ messages in thread From: Kees Cook @ 2020-11-20 19:30 UTC (permalink / raw) To: Jakub Kicinski Cc: alsa-devel, linux-atm-general, reiserfs-devel, linux-iio, linux-wireless, linux-fbdev, dri-devel, linux-kernel, Nathan Chancellor, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, samba-technical, linux-i3c, linux1394-devel, linux-afs, usb-storage, drbd-dev, devel, linux-cifs, rds-devel, Nick Desaulniers, linux-scsi, linux-rdma, oss-drivers, bridge, linux-security-module, amd-gfx, linux-stm32, cluster-devel, linux-acpi, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, tipc-discussion, linux-ext4, linux-media, linux-watchdog, selinux, linux-arm-msm, intel-gfx, linux-geode, linux-can, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, ceph-devel, virtualization, linux-arm-kernel, linux-hwmon, x86, linux-nfs, GR-Linux-NIC-Dev, linux-mm, netdev, linux-decnet-user, linux-mmc, Gustavo A. R. Silva, linux-renesas-soc, linux-sctp, linux-usb, netfilter-devel, linux-crypto, patches, Joe Perches, linux-integrity, target-devel, linux-hardening 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. -- Kees Cook _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
[parent not found: <20201120115142.292999b2@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>]
* Re: [PATCH 000/141] Fix fall-through warnings for Clang [not found] ` <20201120115142.292999b2@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> @ 2020-11-20 20:48 ` Kees Cook 2020-11-22 16:17 ` Kees Cook 1 sibling, 0 replies; 39+ messages in thread From: Kees Cook @ 2020-11-20 20:48 UTC (permalink / raw) To: Jakub Kicinski Cc: alsa-devel, linux-atm-general, reiserfs-devel, linux-iio, linux-wireless, linux-fbdev, dri-devel, linux-kernel, Nathan Chancellor, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, samba-technical, linux-i3c, linux1394-devel, linux-afs, usb-storage, drbd-dev, devel, linux-cifs, rds-devel, Nick Desaulniers, linux-scsi, linux-rdma, oss-drivers, bridge, linux-security-module, amd-gfx, linux-stm32, cluster-devel, linux-acpi, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, tipc-discussion, linux-ext4, linux-media, linux-watchdog, selinux, linux-arm-msm, intel-gfx, linux-geode, linux-can, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, ceph-devel, virtualization, linux-arm-kernel, linux-hwmon, x86, linux-nfs, GR-Linux-NIC-Dev, linux-mm, netdev, linux-decnet-user, linux-mmc, Gustavo A. R. Silva, linux-renesas-soc, linux-sctp, linux-usb, netfilter-devel, linux-crypto, patches, Joe Perches, linux-integrity, target-devel, linux-hardening 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. I'd like to avoid splitting common -W options between default and W=2 just based on the compiler. Getting -Wimplicit-fallthrough enabled found plenty of bugs, so making sure it works correctly for both compilers feels justified to me. (This is just a subset of the same C language short-coming.) > I think clang is just being annoying here, but if I'm the only one who > feels this way chances are I'm wrong :) It's being pretty pedantic, but I don't think it's unreasonable to explicitly state how every case ends. GCC's silence for the case of "fall through to a break" doesn't really seem justified. -- Kees Cook _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 000/141] Fix fall-through warnings for Clang [not found] ` <20201120115142.292999b2@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> 2020-11-20 20:48 ` Kees Cook @ 2020-11-22 16:17 ` Kees Cook [not found] ` <9b57fd4914b46f38d54087d75e072d6e947cb56d.camel@HansenPartnership.com> ` (2 more replies) 1 sibling, 3 replies; 39+ messages in thread From: Kees Cook @ 2020-11-22 16:17 UTC (permalink / raw) To: Jakub Kicinski Cc: alsa-devel, linux-atm-general, reiserfs-devel, linux-iio, linux-wireless, linux-fbdev, dri-devel, linux-kernel, Nathan Chancellor, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, samba-technical, linux-i3c, linux1394-devel, linux-afs, usb-storage, drbd-dev, devel, linux-cifs, rds-devel, Nick Desaulniers, linux-scsi, linux-rdma, oss-drivers, bridge, linux-security-module, amd-gfx, linux-stm32, cluster-devel, linux-acpi, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, tipc-discussion, linux-ext4, linux-media, linux-watchdog, selinux, linux-arm-msm, intel-gfx, linux-geode, linux-can, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, ceph-devel, virtualization, linux-arm-kernel, linux-hwmon, x86, linux-nfs, GR-Linux-NIC-Dev, linux-mm, netdev, linux-decnet-user, linux-mmc, Gustavo A. R. Silva, linux-renesas-soc, linux-sctp, linux-usb, netfilter-devel, linux-crypto, patches, Joe Perches, linux-integrity, target-devel, linux-hardening 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@mail.gmail.com/ -- Kees Cook _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
[parent not found: <9b57fd4914b46f38d54087d75e072d6e947cb56d.camel@HansenPartnership.com>]
* Re: [PATCH 000/141] Fix fall-through warnings for Clang [not found] ` <9b57fd4914b46f38d54087d75e072d6e947cb56d.camel@HansenPartnership.com> @ 2020-11-22 18:25 ` Joe Perches [not found] ` <0147972a72bc13f3629de8a32dee6f1f308994b5.camel@HansenPartnership.com> 2020-11-22 20:35 ` Miguel Ojeda 2020-11-22 22:10 ` Sam Ravnborg 2 siblings, 1 reply; 39+ messages in thread From: Joe Perches @ 2020-11-22 18:25 UTC (permalink / raw) To: James Bottomley, Kees Cook, Jakub Kicinski Cc: alsa-devel, linux-atm-general, reiserfs-devel, linux-iio, linux-wireless, linux-fbdev, dri-devel, linux-kernel, Nathan Chancellor, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, samba-technical, linux-i3c, linux1394-devel, linux-afs, usb-storage, drbd-dev, devel, linux-cifs, rds-devel, Nick Desaulniers, linux-scsi, linux-rdma, oss-drivers, bridge, linux-security-module, amd-gfx, linux-stm32, cluster-devel, linux-acpi, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, tipc-discussion, linux-ext4, linux-media, linux-watchdog, selinux, linux-arm-msm, intel-gfx, linux-geode, linux-can, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, ceph-devel, virtualization, linux-arm-kernel, linux-hwmon, x86, linux-nfs, GR-Linux-NIC-Dev, linux-mm, netdev, linux-decnet-user, linux-mmc, Gustavo A. R. Silva, linux-renesas-soc, linux-sctp, linux-usb, netfilter-devel, linux-crypto, patches, linux-integrity, target-devel, linux-hardening On Sun, 2020-11-22 at 10:21 -0800, James Bottomley wrote: > Please tell me > our reward for all this effort isn't a single missing error print. There were quite literally dozens of logical defects found by the fallthrough additions. Very few were logging only. _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
[parent not found: <0147972a72bc13f3629de8a32dee6f1f308994b5.camel@HansenPartnership.com>]
* Re: [PATCH 000/141] Fix fall-through warnings for Clang [not found] ` <0147972a72bc13f3629de8a32dee6f1f308994b5.camel@HansenPartnership.com> @ 2020-11-22 19:22 ` Joe Perches [not found] ` <dbd2cb703ed9eefa7dde9281ea26ab0f7acc8afe.camel@HansenPartnership.com> 0 siblings, 1 reply; 39+ messages in thread From: Joe Perches @ 2020-11-22 19:22 UTC (permalink / raw) To: James Bottomley, Kees Cook, Jakub Kicinski Cc: alsa-devel, linux-atm-general, reiserfs-devel, linux-iio, linux-wireless, linux-fbdev, dri-devel, linux-kernel, Nathan Chancellor, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, samba-technical, linux-i3c, linux1394-devel, linux-afs, usb-storage, drbd-dev, devel, linux-cifs, rds-devel, Nick Desaulniers, linux-scsi, linux-rdma, oss-drivers, bridge, linux-security-module, amd-gfx, linux-stm32, cluster-devel, linux-acpi, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, tipc-discussion, linux-ext4, linux-media, linux-watchdog, selinux, linux-arm-msm, intel-gfx, linux-geode, linux-can, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, ceph-devel, virtualization, linux-arm-kernel, linux-hwmon, x86, linux-nfs, GR-Linux-NIC-Dev, linux-mm, netdev, linux-decnet-user, linux-mmc, Gustavo A. R. Silva, linux-renesas-soc, linux-sctp, linux-usb, netfilter-devel, linux-crypto, patches, linux-integrity, target-devel, linux-hardening On Sun, 2020-11-22 at 11:12 -0800, James Bottomley wrote: > On Sun, 2020-11-22 at 10:25 -0800, Joe Perches wrote: > > On Sun, 2020-11-22 at 10:21 -0800, James Bottomley wrote: > > > Please tell me our reward for all this effort isn't a single > > > missing error print. > > > > There were quite literally dozens of logical defects found > > by the fallthrough additions. Very few were logging only. > > So can you give us the best examples (or indeed all of them if someone > is keeping score)? hopefully this isn't a US election situation ... Gustavo? Are you running for congress now? https://lwn.net/Articles/794944/ _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
[parent not found: <dbd2cb703ed9eefa7dde9281ea26ab0f7acc8afe.camel@HansenPartnership.com>]
[parent not found: <20201123130348.GA3119@embeddedor>]
[parent not found: <8f5611bb015e044fa1c0a48147293923c2d904e4.camel@HansenPartnership.com>]
* Re: [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang [not found] ` <8f5611bb015e044fa1c0a48147293923c2d904e4.camel@HansenPartnership.com> @ 2020-11-24 21:32 ` Kees Cook [not found] ` <alpine.LNX.2.23.453.2011250859290.15@nippy.intranet> [not found] ` <a841536fe65bb33f1c72ce2455a6eb47a0107565.camel@HansenPartnership.com> 0 siblings, 2 replies; 39+ messages in thread From: Kees Cook @ 2020-11-24 21:32 UTC (permalink / raw) To: James Bottomley Cc: alsa-devel, bridge, target-devel, Greg KH, linux-iio, samba-technical, Jonathan Cameron, linux-fbdev, dri-devel, Gustavo A. R. Silva, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, linux-i3c, linux1394-devel, linux-afs, drbd-dev, devel, linux-cifs, rds-devel, linux-scsi, linux-acpi, linux-rdma, oss-drivers, linux-atm-general, ceph-devel, amd-gfx, linux-stm32, cluster-devel, usb-storage, linux-mmc, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, Jakub Kicinski, linux-ext4, virtualization, netfilter-devel, linux-media, linux-watchdog, selinux, linux-arm-msm, intel-gfx, linux-sctp, reiserfs-devel, linux-geode, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, Nathan Chancellor, linux-can, linux-arm-kernel, linux-hwmon, Nick Desaulniers, linux-nfs, GR-Linux-NIC-Dev, linux-mm, netdev, linux-decnet-user, linux-wireless, linux-kernel, linux-renesas-soc, linux-security-module, linux-usb, tipc-discussion, linux-crypto, patches, Joe Perches, linux-integrity, x86, linux-hardening On Mon, Nov 23, 2020 at 08:31:30AM -0800, James Bottomley wrote: > Really, no ... something which produces no improvement has no value at > all ... we really shouldn't be wasting maintainer time with it because > it has a cost to merge. I'm not sure we understand where the balance > lies in value vs cost to merge but I am confident in the zero value > case. What? We can't measure how many future bugs aren't introduced because the kernel requires explicit case flow-control statements for all new code. We already enable -Wimplicit-fallthrough globally, so that's not the discussion. The issue is that Clang is (correctly) even more strict than GCC for this, so these are the remaining ones to fix for full Clang coverage too. People have spent more time debating this already than it would have taken to apply the patches. :) This is about robustness and language wrangling. It's a big code-base, and this is the price of our managing technical debt for permanent robustness improvements. (The numbers I ran from Gustavo's earlier patches were that about 10% of the places adjusted were identified as legitimate bugs being fixed. This final series may be lower, but there are still bugs being found from it -- we need to finish this and shut the door on it for good.) -- Kees Cook _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
[parent not found: <alpine.LNX.2.23.453.2011250859290.15@nippy.intranet>]
* Re: [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang [not found] ` <alpine.LNX.2.23.453.2011250859290.15@nippy.intranet> @ 2020-11-24 23:15 ` Miguel Ojeda [not found] ` <alpine.LNX.2.23.453.2011251022550.14@nippy.intranet> 0 siblings, 1 reply; 39+ messages in thread From: Miguel Ojeda @ 2020-11-24 23:15 UTC (permalink / raw) To: Finn Thain Cc: alsa-devel, bridge, target-devel, Greg KH, linux-iio, linux-wireless, Jonathan Cameron, linux-fbdev, dri-devel, Gustavo A. R. Silva, James Bottomley, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, linux-i3c, linux1394-devel, linux-afs, drbd-dev, devel, linux-cifs, rds-devel, linux-scsi, linux-acpi, linux-rdma, oss-drivers, linux-atm-general, ceph-devel, amd-gfx, linux-stm32, cluster-devel, usb-storage, linux-mmc, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, Jakub Kicinski, Ext4 Developers List, virtualization, netfilter-devel, Linux Media Mailing List, Kees Cook, selinux, linux-arm-msm, intel-gfx, linux-sctp, reiserfs-devel, linux-geode, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, Nathan Chancellor, linux-can, Linux ARM, linux-hwmon, Nick Desaulniers, linux-watchdog, GR-Linux-NIC-Dev, Linux-MM, Network Development, linux-decnet-user, samba-technical, linux-kernel, linux-renesas-soc, linux-security-module, linux-usb, tipc-discussion, Linux Crypto Mailing List, patches, Joe Perches, linux-integrity, linux-nfs, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), linux-hardening On Tue, Nov 24, 2020 at 11:24 PM Finn Thain <fthain@telegraphics.com.au> wrote: > > These statements are not "missing" unless you presume that code written > before the latest de facto language spec was written should somehow be > held to that spec. There is no "language spec" the kernel adheres to. Even if it did, kernel code is not frozen. If an improvement is found, it should be applied. > If the 'fallthrough' statement is not part of the latest draft spec then > we should ask why not before we embrace it. Being that the kernel still > prefers -std=gnu89 you might want to consider what has prevented > -std=gnu99 or -std=gnu2x etc. The C standard has nothing to do with this. We use compiler extensions of several kinds, for many years. Even discounting those extensions, the kernel is not even conforming to C due to e.g. strict aliasing. I am not sure what you are trying to argue here. But, since you insist: yes, the `fallthrough` attribute is in the current C2x draft. Cheers, Miguel _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
[parent not found: <alpine.LNX.2.23.453.2011251022550.14@nippy.intranet>]
* Re: [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang [not found] ` <alpine.LNX.2.23.453.2011251022550.14@nippy.intranet> @ 2020-11-25 1:05 ` Miguel Ojeda 0 siblings, 0 replies; 39+ messages in thread From: Miguel Ojeda @ 2020-11-25 1:05 UTC (permalink / raw) To: Finn Thain Cc: alsa-devel, bridge, target-devel, Greg KH, linux-iio, linux-wireless, Jonathan Cameron, linux-fbdev, dri-devel, Gustavo A. R. Silva, James Bottomley, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, linux-i3c, linux1394-devel, linux-afs, drbd-dev, devel, linux-cifs, rds-devel, linux-scsi, linux-acpi, linux-rdma, oss-drivers, linux-atm-general, ceph-devel, amd-gfx, linux-stm32, cluster-devel, usb-storage, linux-mmc, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, Jakub Kicinski, Ext4 Developers List, virtualization, netfilter-devel, Linux Media Mailing List, Kees Cook, selinux, linux-arm-msm, intel-gfx, linux-sctp, reiserfs-devel, linux-geode, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, Nathan Chancellor, linux-can, Linux ARM, linux-hwmon, Nick Desaulniers, linux-watchdog, GR-Linux-NIC-Dev, Linux-MM, Network Development, linux-decnet-user, samba-technical, linux-kernel, linux-renesas-soc, linux-security-module, linux-usb, tipc-discussion, Linux Crypto Mailing List, patches, Joe Perches, linux-integrity, linux-nfs, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), linux-hardening On Wed, Nov 25, 2020 at 12:53 AM Finn Thain <fthain@telegraphics.com.au> wrote: > > I'm saying that supporting the official language spec makes more sense > than attempting to support a multitude of divergent interpretations of the > spec (i.e. gcc, clang, coverity etc.) Making the kernel strictly conforming is a ship that sailed long ago, for several reasons. Anyway, supporting several compilers and other tools, regardless of extensions, is valuable. > I'm also saying that the reason why we use -std=gnu89 is that existing > code was written in that language, not in ad hoc languages comprised of > collections of extensions that change with every release. No, we aren't particularly tied to `gnu89` or anything like that. We could actually go for `gnu11` already, since the minimum GCC and Clang support it. Even if a bit of code needs fixing, that shouldn't be a problem if someone puts the work. In other words, the kernel code is not frozen, nor are the features it uses from compilers. They do, in fact, change from time to time. > Thank you for checking. I found a free version that's only 6 weeks old: You're welcome! There are quite a few new attributes coming, mostly following C++ ones. > It will be interesting to see whether 6.7.11.5 changes once the various > implementations reach agreement. Not sure what you mean. The standard does not evolve through implementations' agreement (although standardizing existing practice is one of the best arguments to back a change). Cheers, Miguel _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
[parent not found: <a841536fe65bb33f1c72ce2455a6eb47a0107565.camel@HansenPartnership.com>]
* Re: [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang [not found] ` <a841536fe65bb33f1c72ce2455a6eb47a0107565.camel@HansenPartnership.com> @ 2020-11-25 12:24 ` Nick Desaulniers via Virtualization [not found] ` <20201125082405.1d8c23dc@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> [not found] ` <alpine.LNX.2.23.453.2011260750300.6@nippy.intranet> 2020-11-25 21:10 ` Kees Cook 1 sibling, 2 replies; 39+ messages in thread From: Nick Desaulniers via Virtualization @ 2020-11-25 12:24 UTC (permalink / raw) To: James Bottomley Cc: alsa-devel, bridge, target-devel, Greg KH, linux-iio, samba-technical, Jonathan Cameron, linux-fbdev, dri-devel, Gustavo A. R. Silva, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, linux-i3c, linux1394-devel, linux-afs, drbd-dev, devel, linux-cifs, rds-devel, linux-scsi, linux-acpi, linux-rdma, oss-drivers, linux-atm-general, ceph-devel, amd-gfx list, linux-stm32, cluster-devel, usb-storage, linux-mmc, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, Jakub Kicinski, linux-ext4, virtualization, netfilter-devel, linux-media, Kees Cook, selinux, linux-arm-msm, intel-gfx, linux-sctp, reiserfs-devel, linux-geode, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, Nathan Chancellor, linux-can, Linux ARM, linux-hwmon, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), linux-watchdog, GR-Linux-NIC-Dev, Linux Memory Management List, Network Development, linux-decnet-user, linux-wireless, LKML, Linux-Renesas, linux-security-module, linux-usb, tipc-discussion, open list:HARDWARE RANDOM NUMBER GENERATOR CORE, patches, Joe Perches, linux-integrity, linux-nfs, linux-hardening On Tue, Nov 24, 2020 at 11:05 PM James Bottomley <James.Bottomley@hansenpartnership.com> wrote: > > On Tue, 2020-11-24 at 13:32 -0800, Kees Cook wrote: > > We already enable -Wimplicit-fallthrough globally, so that's not the > > discussion. The issue is that Clang is (correctly) even more strict > > than GCC for this, so these are the remaining ones to fix for full > > Clang coverage too. > > > > People have spent more time debating this already than it would have > > taken to apply the patches. :) > > You mean we've already spent 90% of the effort to come this far so we > might as well go the remaining 10% because then at least we get some > return? It's certainly a clinching argument in defence procurement ... So developers and distributions using Clang can't have -Wimplicit-fallthrough enabled because GCC is less strict (which has been shown in this thread to lead to bugs)? We'd like to have nice things too, you know. I even agree that most of the churn comes from case 0: ++x; default: break; which I have a patch for: https://reviews.llvm.org/D91895. I agree that can never lead to bugs. But that's not the sole case of this series, just most of them. Though, note how the reviewer (C++ spec editor and clang front end owner) in https://reviews.llvm.org/D91895 even asks in that review how maybe a new flag would be more appropriate for a watered down/stylistic variant of the existing behavior. And if the current wording of Documentation/process/deprecated.rst around "fallthrough" is a straightforward rule of thumb, I kind of agree with him. > > > This is about robustness and language wrangling. It's a big code- > > base, and this is the price of our managing technical debt for > > permanent robustness improvements. (The numbers I ran from Gustavo's > > earlier patches were that about 10% of the places adjusted were > > identified as legitimate bugs being fixed. This final series may be > > lower, but there are still bugs being found from it -- we need to > > finish this and shut the door on it for good.) > > I got my six patches by analyzing the lwn.net report of the fixes that > was cited which had 21 of which 50% didn't actually change the emitted > code, and 25% didn't have a user visible effect. > > But the broader point I'm making is just because the compiler people > come up with a shiny new warning doesn't necessarily mean the problem That's not what this is though; you're attacking a strawman. I'd encourage you to bring that up when that actually occurs, unlike this case since it's actively hindering getting -Wimplicit-fallthrough enabled for Clang. This is not a shiny new warning; it's already on for GCC and has existed in both compilers for multiple releases. And I'll also note that warnings are warnings and not errors because they cannot be proven to be bugs in 100% of cases, but they have led to bugs in the past. They require a human to review their intent and remove ambiguities. If 97% of cases would end in a break ("Expert C Programming: Deep C Secrets" - Peter van der Linden), then it starts to look to me like a language defect; certainly an incorrectly chosen default. But the compiler can't know those 3% were intentional, unless you're explicit for those exceptional cases. > it's detecting is one that causes us actual problems in the code base. > I'd really be happier if we had a theory about what classes of CVE or > bug we could eliminate before we embrace the next new warning. We don't generally file CVEs and waiting for them to occur might be too reactive, but I agree that pointing to some additional documentation in commit messages about how a warning could lead to a bug would make it clearer to reviewers why being able to enable it treewide, even if there's no bug in their particular subsystem, is in the general interest of the commons. On Mon, Nov 23, 2020 at 7:58 AM James Bottomley <James.Bottomley@hansenpartnership.com> wrote: > > We're also complaining about the inability to recruit maintainers: > > https://www.theregister.com/2020/06/30/hard_to_find_linux_maintainers_says_torvalds/ > > And burn out: > > http://antirez.com/news/129 > > The whole crux of your argument seems to be maintainers' time isn't > important so we should accept all trivial patches ... I'm pushing back > on that assumption in two places, firstly the valulessness of the time > and secondly that all trivial patches are valuable. It's critical to the longevity of any open source project that there are not single points of failure. If someone is not expendable or replaceable (or claims to be) then that's a risk to the project and a bottleneck. Not having a replacement in training or some form of redundancy is short sighted. If trivial patches are adding too much to your workload, consider training a co-maintainer or asking for help from one of your reviewers whom you trust. I don't doubt it's hard to find maintainers, but existing maintainers should go out of their way to entrust co-maintainers especially when they find their workload becomes too high. And reviewing/picking up trivial patches is probably a great way to get started. If we allow too much knowledge of any one subsystem to collect with one maintainer, what happens when that maintainer leaves the community (which, given a finite lifespan, is an inevitability)? -- Thanks, ~Nick Desaulniers _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
[parent not found: <20201125082405.1d8c23dc@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>]
* Re: [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang [not found] ` <20201125082405.1d8c23dc@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> @ 2020-11-25 17:04 ` Miguel Ojeda 2020-11-25 22:09 ` Nick Desaulniers via Virtualization 1 sibling, 0 replies; 39+ messages in thread From: Miguel Ojeda @ 2020-11-25 17:04 UTC (permalink / raw) To: Jakub Kicinski Cc: alsa-devel, bridge, linux-iio, linux-wireless, linux-fbdev, dri-devel, LKML, James Bottomley, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, linux-i3c, linux1394-devel, linux-afs, drbd-dev, devel, linux-cifs, rds-devel, linux-scsi, linux-acpi, linux-rdma, oss-drivers, linux-atm-general, ceph-devel, amd-gfx list, linux-stm32, cluster-devel, usb-storage, linux-mmc, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, xen-devel, Ext4 Developers List, virtualization, netfilter-devel, Linux Media Mailing List, Kees Cook, selinux, linux-arm-msm, intel-gfx, linux-sctp, reiserfs-devel, linux-geode, linux-block, linux-gpio, op-tee, linux-mediatek, nouveau, linux-hams, Nathan Chancellor, linux-can, Linux ARM, linux-hwmon, Nick Desaulniers, linux-watchdog, GR-Linux-NIC-Dev, Linux Memory Management List, Network Development, linux-decnet-user, samba-technical, Gustavo A. R. Silva, Linux-Renesas, linux-security-module, linux-usb, tipc-discussion, open list:HARDWARE RANDOM NUMBER GENERATOR CORE <linux-crypto@vger.kernel.org>, patches@opensource.cirrus.com, linux-integrity@vger.kernel.org, target-devel@vger.kernel.org, linux-hardening@vger.kernel.org, Jonathan Cameron <Jonathan.Cameron@huawei.com>, Greg KH, Joe Perches, linux-nfs, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT) On Wed, Nov 25, 2020 at 5:24 PM Jakub Kicinski <kuba@kernel.org> wrote: > > And just to spell it out, > > case ENUM_VALUE1: > bla(); > break; > case ENUM_VALUE2: > bla(); > default: > break; > > is a fairly idiomatic way of indicating that not all values of the enum > are expected to be handled by the switch statement. It looks like a benign typo to me -- `ENUM_VALUE2` does not follow the same pattern like `ENUM_VALUE1`. To me, the presence of the `default` is what indicates (explicitly) that not everything is handled. > Applying a real patch set and then getting a few follow ups the next day > for trivial coding things like fallthrough missing or static missing, > just because I didn't have the full range of compilers to check with > before applying makes me feel pretty shitty, like I'm not doing a good > job. YMMV. The number of compilers, checkers, static analyzers, tests, etc. we use keeps going up. That, indeed, means maintainers will miss more things (unless maintainers do more work than before). But catching bugs before they happen is *not* a bad thing. Perhaps we could encourage more rebasing in -next (while still giving credit to bots and testers) to avoid having many fixing commits afterwards, but that is orthogonal. I really don't think we should encourage the feeling that a maintainer is doing a bad job if they don't catch everything on their reviews. Any review is worth it. Maintainers, in the end, are just the "guaranteed" reviewers that decide when the code looks reasonable enough. They should definitely not feel pressured to be perfect. Cheers, Miguel _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang [not found] ` <20201125082405.1d8c23dc@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> 2020-11-25 17:04 ` Miguel Ojeda @ 2020-11-25 22:09 ` Nick Desaulniers via Virtualization 1 sibling, 0 replies; 39+ messages in thread From: Nick Desaulniers via Virtualization @ 2020-11-25 22:09 UTC (permalink / raw) To: Jakub Kicinski Cc: alsa-devel, bridge, linux-iio, linux-wireless, linux-fbdev, dri-devel, Gustavo A. R. Silva, James Bottomley, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, linux-i3c, linux1394-devel, linux-afs, drbd-dev, devel, linux-cifs, rds-devel, linux-scsi, linux-acpi, linux-rdma, oss-drivers, linux-atm-general, ceph-devel, amd-gfx list, linux-stm32, cluster-devel, usb-storage, linux-mmc, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, xen-devel, linux-ext4, virtualization, netfilter-devel, linux-media, Kees Cook, selinux, linux-arm-msm, intel-gfx, linux-sctp, reiserfs-devel, linux-geode, linux-block, linux-gpio, op-tee, linux-mediatek, nouveau, linux-hams, Nathan Chancellor, linux-can, Linux ARM, linux-hwmon, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), linux-watchdog, GR-Linux-NIC-Dev, Linux Memory Management List, Network Development, linux-decnet-user, samba-technical, LKML, Linux-Renesas, linux-security-module, linux-usb, tipc-discussion, open list:HARDWARE RANDOM NUMBER GENERATOR CORE <linux-crypto@vger.kernel.org>, patches@opensource.cirrus.com, linux-integrity@vger.kernel.org, target-devel@vger.kernel.org, linux-hardening@vger.kernel.org, Jonathan Cameron <Jonathan.Cameron@huawei.com>, Greg KH, Joe Perches, linux-nfs On Wed, Nov 25, 2020 at 8:24 AM Jakub Kicinski <kuba@kernel.org> wrote: > > Applying a real patch set and then getting a few follow ups the next day > for trivial coding things like fallthrough missing or static missing, > just because I didn't have the full range of compilers to check with > before applying makes me feel pretty shitty, like I'm not doing a good > job. YMMV. I understand. Everyone feels that way, except maybe Bond villains and robots. My advice in that case is don't take it personally. We're working with a language that's more error prone relative to others. While one would like to believe they are flawless, over time they can't beat the aggregate statistics. A balance between Imposter Syndrome and Dunning Kruger is walked by all software developers, and the fear of making mistakes in public is one of the number one reasons folks don't take the plunge contributing to open source software or even the kernel. My advice to them is "don't sweat the small stuff." -- Thanks, ~Nick Desaulniers _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
[parent not found: <alpine.LNX.2.23.453.2011260750300.6@nippy.intranet>]
* Re: [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang [not found] ` <alpine.LNX.2.23.453.2011260750300.6@nippy.intranet> @ 2020-11-25 22:09 ` Nick Desaulniers via Virtualization 0 siblings, 0 replies; 39+ messages in thread From: Nick Desaulniers via Virtualization @ 2020-11-25 22:09 UTC (permalink / raw) To: Finn Thain Cc: alsa-devel, bridge, target-devel, Greg KH, linux-iio, linux-wireless, Jonathan Cameron, linux-fbdev, dri-devel, Gustavo A. R. Silva, James Bottomley, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, linux-i3c, linux1394-devel, linux-afs, drbd-dev, devel, linux-cifs, rds-devel, linux-scsi, linux-acpi, linux-rdma, oss-drivers, linux-atm-general, ceph-devel, amd-gfx list, linux-stm32, cluster-devel, usb-storage, linux-mmc, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, Jakub Kicinski, linux-ext4, virtualization, netfilter-devel, linux-media, Kees Cook, selinux, linux-arm-msm, intel-gfx, linux-sctp, reiserfs-devel, linux-geode, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, Nathan Chancellor, linux-can, Linux ARM, linux-hwmon, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), linux-watchdog, GR-Linux-NIC-Dev, Linux Memory Management List, Network Development, linux-decnet-user, samba-technical, LKML, Linux-Renesas, linux-security-module, linux-usb, tipc-discussion, open list:HARDWARE RANDOM NUMBER GENERATOR CORE, patches, Joe Perches, linux-integrity, linux-nfs, linux-hardening On Wed, Nov 25, 2020 at 1:33 PM Finn Thain <fthain@telegraphics.com.au> wrote: > > Or do you think that a codebase can somehow satisfy multiple checkers and > their divergent interpretations of the language spec? Have we found any cases yet that are divergent? I don't think so. It sounds to me like GCC's cases it warns for is a subset of Clang's. Having additional coverage with Clang then should ensure coverage for both. > > This is not a shiny new warning; it's already on for GCC and has existed > > in both compilers for multiple releases. > > > > Perhaps you're referring to the compiler feature that lead to the > ill-fated, tree-wide /* fallthrough */ patch series. > > When the ink dries on the C23 language spec and the implementations figure > out how to interpret it then sure, enforce the warning for new code -- the > cost/benefit analysis is straight forward. However, the case for patching > existing mature code is another story. I don't think we need to wait for the ink to dry on the C23 language spec to understand that implicit fallthrough is an obvious defect of the C language. While the kernel is a mature codebase, it's not immune to bugs. And its maturity has yet to slow its rapid pace of development. -- Thanks, ~Nick Desaulniers _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang [not found] ` <a841536fe65bb33f1c72ce2455a6eb47a0107565.camel@HansenPartnership.com> 2020-11-25 12:24 ` Nick Desaulniers via Virtualization @ 2020-11-25 21:10 ` Kees Cook 1 sibling, 0 replies; 39+ messages in thread From: Kees Cook @ 2020-11-25 21:10 UTC (permalink / raw) To: James Bottomley Cc: alsa-devel, bridge, target-devel, Greg KH, linux-iio, samba-technical, Jonathan Cameron, linux-fbdev, dri-devel, Gustavo A. R. Silva, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, linux-i3c, linux1394-devel, linux-afs, drbd-dev, devel, linux-cifs, rds-devel, linux-scsi, linux-acpi, linux-rdma, oss-drivers, linux-atm-general, ceph-devel, amd-gfx, linux-stm32, cluster-devel, usb-storage, linux-mmc, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, Jakub Kicinski, linux-ext4, virtualization, netfilter-devel, linux-media, linux-watchdog, selinux, linux-arm-msm, intel-gfx, linux-sctp, reiserfs-devel, linux-geode, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, Nathan Chancellor, linux-can, linux-arm-kernel, linux-hwmon, Nick Desaulniers, linux-nfs, GR-Linux-NIC-Dev, linux-mm, netdev, linux-decnet-user, linux-wireless, linux-kernel, linux-renesas-soc, linux-security-module, linux-usb, tipc-discussion, linux-crypto, patches, Joe Perches, linux-integrity, x86, linux-hardening On Tue, Nov 24, 2020 at 11:05:35PM -0800, James Bottomley wrote: > Now, what we have seems to be about 6 cases (at least what's been shown > in this thread) where a missing break would cause potentially user > visible issues. That means the value of this isn't zero, but it's not > a no-brainer massive win either. That's why I think asking what we've > invested vs the return isn't a useless exercise. The number is much higher[1]. If it were 6 in the entire history of the kernel, I would agree with you. :) Some were fixed _before_ Gustavo's effort too, which I also count towards the idea of "this is a dangerous weakness in C, and now we have stopped it forever." > But the broader point I'm making is just because the compiler people > come up with a shiny new warning doesn't necessarily mean the problem > it's detecting is one that causes us actual problems in the code base. > I'd really be happier if we had a theory about what classes of CVE or > bug we could eliminate before we embrace the next new warning. But we did! It was long ago justified and documented[2], and even links to the CWE[3] for it. This wasn't random joy over discovering a new warning we could turn on, this was turning on a warning that the compiler folks finally gave us to handle an entire class of flaws. If we need to update the code-base to address it not a useful debate -- that was settled already, even if you're only discovering it now. :P. This last patch set is about finishing that work for Clang, which is correctly even more strict than GCC. -Kees [1] https://outflux.net/slides/2019/lss/kspp.pdf calls out specific numbers (about 6.5% of the patches fixed missing breaks): v4.19: 3 of 129 v4.20: 2 of 59 v5.0: 3 of 56 v5.1: 10 of 100 v5.2: 6 of 71 v5.3: 7 of 69 And in the history of the kernel, it's been an ongoing source of flaws: $ l --no-merges | grep -i 'missing break' | wc -l 185 The frequency of such errors being "naturally" found was pretty steady until the static checkers started warning, and then it was on the rise, but the full effort flushed the rest out, and now it's dropped to almost zero: 1 v2.6.12 3 v2.6.16.28 1 v2.6.17 1 v2.6.19 2 v2.6.21 1 v2.6.22 3 v2.6.24 3 v2.6.29 1 v2.6.32 1 v2.6.33 1 v2.6.35 4 v2.6.36 3 v2.6.38 2 v2.6.39 7 v3.0 2 v3.1 2 v3.2 2 v3.3 3 v3.4 1 v3.5 8 v3.6 7 v3.7 3 v3.8 6 v3.9 3 v3.10 2 v3.11 5 v3.12 5 v3.13 2 v3.14 4 v3.15 2 v3.16 3 v3.17 2 v3.18 2 v3.19 1 v4.0 2 v4.1 5 v4.2 4 v4.5 5 v4.7 6 v4.8 1 v4.9 3 v4.10 2 v4.11 6 v4.12 3 v4.13 2 v4.14 5 v4.15 2 v4.16 7 v4.18 2 v4.19 6 v4.20 3 v5.0 12 v5.1 3 v5.2 4 v5.3 2 v5.4 1 v5.8 And the reason it's fully zero, is because we still have the cases we're cleaning up right now. Even this last one from v5.8 is specifically of the same type this series addresses: case 4: color_index = TrueCModeIndex; + break; default: return; } [2] https://www.kernel.org/doc/html/latest/process/deprecated.html#implicit-switch-case-fall-through All switch/case blocks must end in one of: break; fallthrough; continue; goto <label>; return [expression]; [3] https://cwe.mitre.org/data/definitions/484.html -- Kees Cook _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 000/141] Fix fall-through warnings for Clang [not found] ` <9b57fd4914b46f38d54087d75e072d6e947cb56d.camel@HansenPartnership.com> 2020-11-22 18:25 ` Joe Perches @ 2020-11-22 20:35 ` Miguel Ojeda [not found] ` <alpine.LNX.2.23.453.2011230938390.7@nippy.intranet> [not found] ` <1c7d7fde126bc0acf825766de64bf2f9b888f216.camel@HansenPartnership.com> 2020-11-22 22:10 ` Sam Ravnborg 2 siblings, 2 replies; 39+ messages in thread From: Miguel Ojeda @ 2020-11-22 20:35 UTC (permalink / raw) To: James Bottomley Cc: alsa-devel, linux-atm-general, reiserfs-devel, linux-iio, linux-wireless, linux-fbdev, dri-devel, Gustavo A. R. Silva, Nathan Chancellor, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, samba-technical, linux-i3c, linux1394-devel, linux-afs, usb-storage, drbd-dev, devel, linux-cifs, rds-devel, Nick Desaulniers, linux-scsi, linux-rdma, oss-drivers, bridge, linux-security-module, amd-gfx, linux-stm32, cluster-devel, linux-acpi, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, Jakub Kicinski, Ext4 Developers List, Linux Media Mailing List, Kees Cook, selinux, linux-arm-msm, intel-gfx, linux-geode, linux-can, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, ceph-devel, virtualization, Linux ARM, linux-hwmon, linux-watchdog, linux-nfs, GR-Linux-NIC-Dev, tipc-discussion, Linux-MM, Network Development, linux-decnet-user, linux-mmc, linux-kernel, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), linux-renesas-soc, linux-sctp, linux-usb, netfilter-devel, Linux Crypto Mailing List, patches, Joe Perches, linux-integrity, target-devel, linux-hardening On Sun, Nov 22, 2020 at 7:22 PM James Bottomley <James.Bottomley@hansenpartnership.com> wrote: > > Well, it's a problem in an error leg, sure, but it's not a really > compelling reason for a 141 patch series, is it? All that fixing this > error will do is get the driver to print "oh dear there's a problem" > under four more conditions than it previously did. > > We've been at this for three years now with nearly a thousand patches, > firstly marking all the fall throughs with /* fall through */ and later > changing it to fallthrough. At some point we do have to ask if the > effort is commensurate with the protection afforded. Please tell me > our reward for all this effort isn't a single missing error print. It isn't that much effort, isn't it? Plus we need to take into account the future mistakes that it might prevent, too. So even if there were zero problems found so far, it is still a positive change. I would agree if these changes were high risk, though; but they are almost trivial. Cheers, Miguel _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
[parent not found: <alpine.LNX.2.23.453.2011230938390.7@nippy.intranet>]
* Re: [PATCH 000/141] Fix fall-through warnings for Clang [not found] ` <alpine.LNX.2.23.453.2011230938390.7@nippy.intranet> @ 2020-11-23 14:05 ` Miguel Ojeda [not found] ` <alpine.LNX.2.23.453.2011241036520.7@nippy.intranet> 0 siblings, 1 reply; 39+ messages in thread From: Miguel Ojeda @ 2020-11-23 14:05 UTC (permalink / raw) To: Finn Thain Cc: alsa-devel, linux-atm-general, reiserfs-devel, linux-iio, linux-wireless, linux-fbdev, dri-devel, Gustavo A. R. Silva, James Bottomley, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, samba-technical, linux-i3c, linux1394-devel, linux-afs, usb-storage, drbd-dev, devel, linux-cifs, rds-devel, Nick Desaulniers, linux-scsi, Nathan Chancellor, linux-rdma, oss-drivers, bridge, linux-security-module, amd-gfx, linux-stm32, cluster-devel, linux-acpi, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, Jakub Kicinski, Ext4 Developers List, Linux Media Mailing List, Kees Cook, selinux, linux-arm-msm, intel-gfx, linux-geode, linux-can, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, ceph-devel, virtualization, Linux ARM, linux-hwmon, linux-watchdog, linux-nfs, GR-Linux-NIC-Dev, tipc-discussion, Linux-MM, Network Development, linux-decnet-user, linux-mmc, linux-kernel, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), linux-renesas-soc, linux-sctp, linux-usb, netfilter-devel, Linux Crypto Mailing List, patches, Joe Perches, linux-integrity, target-devel, linux-hardening On Sun, Nov 22, 2020 at 11:54 PM Finn Thain <fthain@telegraphics.com.au> wrote: > > We should also take into account optimisim about future improvements in > tooling. Not sure what you mean here. There is no reliable way to guess what the intention was with a missing fallthrough, even if you parsed whitespace and indentation. > It is if you want to spin it that way. How is that a "spin"? It is a fact that we won't get *implicit* fallthrough mistakes anymore (in particular if we make it a hard error). > But what we inevitably get is changes like this: > > case 3: > this(); > + break; > case 4: > hmmm(); > > Why? Mainly to silence the compiler. Also because the patch author argued > successfully that they had found a theoretical bug, often in mature code. If someone changes control flow, that is on them. Every kernel developer knows what `break` does. > But is anyone keeping score of the regressions? If unreported bugs count, > what about unreported regressions? Introducing `fallthrough` does not change semantics. If you are really keen, you can always compare the objects because the generated code shouldn't change. Cheers, Miguel _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
[parent not found: <alpine.LNX.2.23.453.2011241036520.7@nippy.intranet>]
* Re: [PATCH 000/141] Fix fall-through warnings for Clang [not found] ` <alpine.LNX.2.23.453.2011241036520.7@nippy.intranet> @ 2020-11-24 1:05 ` Joe Perches 2020-11-24 23:46 ` Miguel Ojeda 1 sibling, 0 replies; 39+ messages in thread From: Joe Perches @ 2020-11-24 1:05 UTC (permalink / raw) To: Finn Thain, Miguel Ojeda Cc: alsa-devel, linux-atm-general, reiserfs-devel, linux-iio, linux-wireless, linux-fbdev, dri-devel, Gustavo A. R. Silva, James Bottomley, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, samba-technical, linux-i3c, linux1394-devel, linux-afs, usb-storage, drbd-dev, devel, linux-cifs, rds-devel, Nick Desaulniers, linux-scsi, Nathan Chancellor, linux-rdma, oss-drivers, bridge, linux-security-module, amd-gfx, linux-stm32, cluster-devel, linux-acpi, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, Jakub Kicinski, Ext4 Developers List, Linux Media Mailing List, Kees Cook, selinux, linux-arm-msm, intel-gfx, linux-geode, linux-can, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, ceph-devel, virtualization, Linux ARM, linux-hwmon, linux-watchdog, linux-nfs, GR-Linux-NIC-Dev, tipc-discussion, Linux-MM, Network Development, linux-decnet-user, linux-mmc, linux-kernel, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), linux-renesas-soc, linux-sctp, linux-usb, netfilter-devel, Linux Crypto Mailing List, patches, linux-integrity, target-devel, linux-hardening On Tue, 2020-11-24 at 11:58 +1100, Finn Thain wrote: > it's not for me to prove that such patches don't affect code > generation. That's for the patch author and (unfortunately) for reviewers. Ideally, that proof would be provided by the compilation system itself and not patch authors nor reviewers nor maintainers. Unfortunately gcc does not guarantee repeatability or deterministic output. To my knowledge, neither does clang. _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 000/141] Fix fall-through warnings for Clang [not found] ` <alpine.LNX.2.23.453.2011241036520.7@nippy.intranet> 2020-11-24 1:05 ` Joe Perches @ 2020-11-24 23:46 ` Miguel Ojeda 1 sibling, 0 replies; 39+ messages in thread From: Miguel Ojeda @ 2020-11-24 23:46 UTC (permalink / raw) To: Finn Thain Cc: alsa-devel, linux-atm-general, reiserfs-devel, linux-iio, linux-wireless, linux-fbdev, dri-devel, Gustavo A. R. Silva, James Bottomley, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, samba-technical, linux-i3c, linux1394-devel, linux-afs, usb-storage, drbd-dev, devel, linux-cifs, rds-devel, Nick Desaulniers, linux-scsi, Nathan Chancellor, linux-rdma, oss-drivers, bridge, linux-security-module, amd-gfx, linux-stm32, cluster-devel, linux-acpi, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, Jakub Kicinski, Ext4 Developers List, Linux Media Mailing List, Kees Cook, selinux, linux-arm-msm, intel-gfx, linux-geode, linux-can, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, ceph-devel, virtualization, Linux ARM, linux-hwmon, linux-watchdog, linux-nfs, GR-Linux-NIC-Dev, tipc-discussion, Linux-MM, Network Development, linux-decnet-user, linux-mmc, linux-kernel, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), linux-renesas-soc, linux-sctp, linux-usb, netfilter-devel, Linux Crypto Mailing List, patches, Joe Perches, linux-integrity, target-devel, linux-hardening On Tue, Nov 24, 2020 at 1:58 AM Finn Thain <fthain@telegraphics.com.au> wrote: > > What I meant was that you've used pessimism as if it was fact. "future mistakes that it might prevent" is neither pessimism nor states a fact. > For example, "There is no way to guess what the effect would be if the > compiler trained programmers to add a knee-jerk 'break' statement to avoid > a warning". It is only knee-jerk if you think you are infallible. > Moreover, what I meant was that preventing programmer mistakes is a > problem to be solved by development tools This warning comes from a development tool -- the compiler. > The idea that retro-fitting new > language constructs onto mature code is somehow necessary to "prevent > future mistakes" is entirely questionable. The kernel is not a frozen codebase. Further, "mature code vs. risk of change" arguments don't apply here because the semantics of the program and binary output isn't changing. > Sure. And if you put -Wimplicit-fallthrough into the Makefile and if that > leads to well-intentioned patches that cause regressions, it is partly on > you. Again: adding a `fallthrough` does not change the program semantics. If you are a maintainer and want to cross-check, compare the codegen. > Have you ever considered the overall cost of the countless > -Wpresume-incompetence flags? Yeah: negative. On the other hand, the overall cost of the countless -fI-am-infallible flags is very noticeable. > Perhaps you pay the power bill for a build farm that produces logs that > no-one reads? Perhaps you've run git bisect, knowing that the compiler > messages are not interesting? Or compiled software in using a language > that generates impenetrable messages? If so, here's a tip: > > # grep CFLAGS /etc/portage/make.conf > CFLAGS="... -Wno-all -Wno-extra ..." > CXXFLAGS="${CFLAGS}" > > Now allow me some pessimism: the hardware upgrades, gigawatt hours and > wait time attributable to obligatory static analyses are a net loss. If you really believe compiler warnings and static analysis are useless and costly, I think there is not much point in continuing the discussion. > No, it's not for me to prove that such patches don't affect code > generation. That's for the patch author and (unfortunately) for reviewers. I was not asking you to prove it. I am stating that proving it is very easy. Cheers, Miguel _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
[parent not found: <1c7d7fde126bc0acf825766de64bf2f9b888f216.camel@HansenPartnership.com>]
* Re: [PATCH 000/141] Fix fall-through warnings for Clang [not found] ` <1c7d7fde126bc0acf825766de64bf2f9b888f216.camel@HansenPartnership.com> @ 2020-11-23 14:19 ` Miguel Ojeda [not found] ` <fc45750b6d0277c401015b7aa11e16cd15f32ab2.camel@HansenPartnership.com> 0 siblings, 1 reply; 39+ messages in thread From: Miguel Ojeda @ 2020-11-23 14:19 UTC (permalink / raw) To: James Bottomley Cc: alsa-devel, linux-atm-general, reiserfs-devel, linux-iio, linux-wireless, linux-fbdev, dri-devel, Gustavo A. R. Silva, Nathan Chancellor, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, samba-technical, linux-i3c, linux1394-devel, linux-afs, usb-storage, drbd-dev, devel, linux-cifs, rds-devel, Nick Desaulniers, linux-scsi, linux-rdma, oss-drivers, bridge, linux-security-module, amd-gfx, linux-stm32, cluster-devel, linux-acpi, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, Jakub Kicinski, Ext4 Developers List, Linux Media Mailing List, Kees Cook, selinux, linux-arm-msm, intel-gfx, linux-geode, linux-can, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, ceph-devel, virtualization, Linux ARM, linux-hwmon, linux-watchdog, linux-nfs, GR-Linux-NIC-Dev, tipc-discussion, Linux-MM, Network Development, linux-decnet-user, linux-mmc, linux-kernel, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), linux-renesas-soc, linux-sctp, linux-usb, netfilter-devel, Linux Crypto Mailing List, patches, Joe Perches, linux-integrity, target-devel, linux-hardening On Sun, Nov 22, 2020 at 11:36 PM James Bottomley <James.Bottomley@hansenpartnership.com> wrote: > > Well, it seems to be three years of someone's time plus the maintainer > review time and series disruption of nearly a thousand patches. Let's > be conservative and assume the producer worked about 30% on the series > and it takes about 5-10 minutes per patch to review, merge and for > others to rework existing series. So let's say it's cost a person year > of a relatively junior engineer producing the patches and say 100h of > review and application time. The latter is likely the big ticket item > because it's what we have in least supply in the kernel (even though > it's 20x vs the producer time). How are you arriving at such numbers? It is a total of ~200 trivial lines. > It's not about the risk of the changes it's about the cost of > implementing them. Even if you discount the producer time (which > someone gets to pay for, and if I were the engineering manager, I'd be > unhappy about), the review/merge/rework time is pretty significant in > exchange for six minor bug fixes. Fine, when a new compiler warning > comes along it's certainly reasonable to see if we can benefit from it > and the fact that the compiler people think it's worthwhile is enough > evidence to assume this initially. But at some point you have to ask > whether that assumption is supported by the evidence we've accumulated > over the time we've been using it. And if the evidence doesn't support > it perhaps it is time to stop the experiment. Maintainers routinely review 1-line trivial patches, not to mention internal API changes, etc. If some company does not want to pay for that, that's fine, but they don't get to be maintainers and claim `Supported`. Cheers, Miguel _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
[parent not found: <fc45750b6d0277c401015b7aa11e16cd15f32ab2.camel@HansenPartnership.com>]
* Re: [PATCH 000/141] Fix fall-through warnings for Clang [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 2 siblings, 0 replies; 39+ messages in thread From: Rafael J. Wysocki @ 2020-11-23 16:24 UTC (permalink / raw) To: James Bottomley Cc: moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..., linux-atm-general, reiserfs-devel, linux-iio, linux-wireless, open list:FRAMEBUFFER LAYER, dri-devel, linux-kernel, Nathan Chancellor, open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers), dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, samba-technical, linux-i3c, linux1394-devel, linux-afs, usb-storage, drbd-dev, devel, linux-cifs, rds-devel, Nick Desaulniers, open list:TARGET SUBSYSTEM, linux-rdma, oss-drivers, bridge, linux-security-module, amd-gfx list, linux-stm32, cluster-devel, ACPI Devel Maling List, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, Jakub Kicinski, Ext4 Developers List, Linux Media Mailing List, Kees Cook, selinux, linux-arm-msm, intel-gfx, linux-geode, linux-can, linux-block, linux-gpio, op-tee, moderated list:ARM/Mediatek SoC..., xen-devel, nouveau, linux-hams, ceph-devel, virtualization, Linux ARM, linux-hwmon, linux-watchdog, linux-nfs, GR-Linux-NIC-Dev, tipc-discussion, Linux-MM, Network Development, linux-decnet-user, linux-mmc, Gustavo A. R. Silva, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), Linux-Renesas, Miguel Ojeda, linux-sctp, open list:ULTRA-WIDEBAND (UWB) SUBSYSTEM:, netfilter-devel, Linux Crypto Mailing List, patches, Joe Perches, linux-integrity, target-devel, linux-hardening On Mon, Nov 23, 2020 at 4:58 PM James Bottomley <James.Bottomley@hansenpartnership.com> wrote: > > On Mon, 2020-11-23 at 15:19 +0100, Miguel Ojeda wrote: > > On Sun, Nov 22, 2020 at 11:36 PM James Bottomley > > <James.Bottomley@hansenpartnership.com> wrote: [cut] > > > > Maintainers routinely review 1-line trivial patches, not to mention > > internal API changes, etc. > > We're also complaining about the inability to recruit maintainers: > > https://www.theregister.com/2020/06/30/hard_to_find_linux_maintainers_says_torvalds/ > > And burn out: > > http://antirez.com/news/129 Right. > The whole crux of your argument seems to be maintainers' time isn't > important so we should accept all trivial patches ... I'm pushing back > on that assumption in two places, firstly the valulessness of the time > and secondly that all trivial patches are valuable. > > > If some company does not want to pay for that, that's fine, but they > > don't get to be maintainers and claim `Supported`. > > What I'm actually trying to articulate is a way of measuring value of > the patch vs cost ... it has nothing really to do with who foots the > actual bill. > > One thesis I'm actually starting to formulate is that this continual > devaluing of maintainers is why we have so much difficulty keeping and > recruiting them. Absolutely. This is just one of the factors involved, but a significant one IMV. _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 000/141] Fix fall-through warnings for Clang [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 2 siblings, 0 replies; 39+ messages in thread From: Joe Perches @ 2020-11-23 16:32 UTC (permalink / raw) To: James Bottomley, Miguel Ojeda Cc: alsa-devel, linux-atm-general, reiserfs-devel, linux-iio, linux-wireless, linux-fbdev, dri-devel, Gustavo A. R. Silva, Nathan Chancellor, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, samba-technical, linux-i3c, linux1394-devel, linux-afs, usb-storage, drbd-dev, devel, linux-cifs, rds-devel, Nick Desaulniers, linux-scsi, linux-rdma, oss-drivers, bridge, linux-security-module, amd-gfx, linux-stm32, cluster-devel, linux-acpi, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, Jakub Kicinski, Ext4 Developers List, Linux Media Mailing List, Kees Cook, selinux, linux-arm-msm, intel-gfx, linux-geode, linux-can, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, ceph-devel, virtualization, Linux ARM, linux-hwmon, linux-watchdog, linux-nfs, GR-Linux-NIC-Dev, tipc-discussion, Linux-MM, Network Development, linux-decnet-user, linux-mmc, linux-kernel, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), linux-renesas-soc, linux-sctp, linux-usb, netfilter-devel, Linux Crypto Mailing List, patches, linux-integrity, target-devel, linux-hardening On Mon, 2020-11-23 at 07:58 -0800, James Bottomley wrote: > We're also complaining about the inability to recruit maintainers: > > https://www.theregister.com/2020/06/30/hard_to_find_linux_maintainers_says_torvalds/ > > And burn out: > > http://antirez.com/news/129 https://www.wired.com/story/open-source-coders-few-tired/ > What I'm actually trying to articulate is a way of measuring value of > the patch vs cost ... it has nothing really to do with who foots the > actual bill. It's unclear how to measure value in consistency. But one way that costs can be reduced is by automation and _not_ involving maintainers when the patch itself is provably correct. > One thesis I'm actually starting to formulate is that this continual > devaluing of maintainers is why we have so much difficulty keeping and > recruiting them. The linux kernel has something like 1500 different maintainers listed in the MAINTAINERS file. That's not a trivial number. $ git grep '^M:' MAINTAINERS | sort | uniq -c | wc -l 1543 $ git grep '^M:' MAINTAINERS| cut -f1 -d'<' | sort | uniq -c | wc -l 1446 I think the question you are asking is about trust and how it effects development. And back to that wired story, the actual number of what you might be considering to be maintainers is likely less than 10% of the listed numbers above. _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 000/141] Fix fall-through warnings for Clang [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 [not found] ` <4993259d01a0064f8bb22770503490f9252f3659.camel@HansenPartnership.com> 2 siblings, 1 reply; 39+ messages in thread From: Miguel Ojeda @ 2020-11-23 18:56 UTC (permalink / raw) To: James Bottomley Cc: alsa-devel, linux-atm-general, reiserfs-devel, linux-iio, linux-wireless, linux-fbdev, dri-devel, Gustavo A. R. Silva, Nathan Chancellor, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, samba-technical, linux-i3c, linux1394-devel, linux-afs, usb-storage, drbd-dev, devel, linux-cifs, rds-devel, Nick Desaulniers, linux-scsi, linux-rdma, oss-drivers, bridge, linux-security-module, amd-gfx, linux-stm32, cluster-devel, linux-acpi, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, Jakub Kicinski, Ext4 Developers List, Linux Media Mailing List, Kees Cook, selinux, linux-arm-msm, intel-gfx, linux-geode, linux-can, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, ceph-devel, virtualization, Linux ARM, linux-hwmon, linux-watchdog, linux-nfs, GR-Linux-NIC-Dev, tipc-discussion, Linux-MM, Network Development, linux-decnet-user, linux-mmc, linux-kernel, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), linux-renesas-soc, linux-sctp, linux-usb, netfilter-devel, Linux Crypto Mailing List, patches, Joe Perches, linux-integrity, target-devel, linux-hardening On Mon, Nov 23, 2020 at 4:58 PM James Bottomley <James.Bottomley@hansenpartnership.com> wrote: > > Well, I used git. It says that as of today in Linus' tree we have 889 > patches related to fall throughs and the first series went in in > october 2017 ... ignoring a couple of outliers back to February. I can see ~10k insertions over ~1k commits and 15 years that mention a fallthrough in the entire repo. That is including some commits (like the biggest one, 960 insertions) that have nothing to do with C fallthrough. A single kernel release has an order of magnitude more changes than this... But if we do the math, for an author, at even 1 minute per line change and assuming nothing can be automated at all, it would take 1 month of work. For maintainers, a couple of trivial lines is noise compared to many other patches. In fact, this discussion probably took more time than the time it would take to review the 200 lines. :-) > We're also complaining about the inability to recruit maintainers: > > https://www.theregister.com/2020/06/30/hard_to_find_linux_maintainers_says_torvalds/ > > And burn out: > > http://antirez.com/news/129 Accepting trivial and useful 1-line patches is not what makes a voluntary maintainer quit... Thankless work with demanding deadlines is. > The whole crux of your argument seems to be maintainers' time isn't > important so we should accept all trivial patches I have not said that, at all. In fact, I am a voluntary one and I welcome patches like this. It takes very little effort on my side to review and it helps the kernel overall. Paid maintainers are the ones that can take care of big features/reviews. > What I'm actually trying to articulate is a way of measuring value of > the patch vs cost ... it has nothing really to do with who foots the > actual bill. I understand your point, but you were the one putting it in terms of a junior FTE. In my view, 1 month-work (worst case) is very much worth removing a class of errors from a critical codebase. > One thesis I'm actually starting to formulate is that this continual > devaluing of maintainers is why we have so much difficulty keeping and > recruiting them. That may very well be true, but I don't feel anybody has devalued maintainers in this discussion. Cheers, Miguel _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
[parent not found: <4993259d01a0064f8bb22770503490f9252f3659.camel@HansenPartnership.com>]
* Re: [PATCH 000/141] Fix fall-through warnings for Clang [not found] ` <4993259d01a0064f8bb22770503490f9252f3659.camel@HansenPartnership.com> @ 2020-11-25 0:32 ` Miguel Ojeda [not found] ` <44005bde-f6d4-5eaa-39b8-1a5efeedb2d3@gmail.com> 2020-11-25 10:38 ` Andy Shevchenko 1 sibling, 1 reply; 39+ messages in thread From: Miguel Ojeda @ 2020-11-25 0:32 UTC (permalink / raw) To: James Bottomley Cc: alsa-devel, linux-atm-general, reiserfs-devel, linux-iio, linux-wireless, linux-fbdev, dri-devel, Gustavo A. R. Silva, Nathan Chancellor, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, samba-technical, linux-i3c, linux1394-devel, linux-afs, usb-storage, drbd-dev, devel, linux-cifs, rds-devel, Nick Desaulniers, linux-scsi, linux-rdma, oss-drivers, bridge, linux-security-module, amd-gfx, linux-stm32, cluster-devel, linux-acpi, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, Jakub Kicinski, Ext4 Developers List, Linux Media Mailing List, Kees Cook, selinux, linux-arm-msm, intel-gfx, linux-geode, linux-can, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, ceph-devel, virtualization, Linux ARM, linux-hwmon, linux-watchdog, linux-nfs, GR-Linux-NIC-Dev, tipc-discussion, Linux-MM, Network Development, linux-decnet-user, linux-mmc, linux-kernel, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), linux-renesas-soc, linux-sctp, linux-usb, netfilter-devel, Linux Crypto Mailing List, patches, Joe Perches, linux-integrity, target-devel, linux-hardening On Mon, Nov 23, 2020 at 9:38 PM James Bottomley <James.Bottomley@hansenpartnership.com> wrote: > > So you think a one line patch should take one minute to produce ... I > really don't think that's grounded in reality. No, I have not said that. Please don't put words in my mouth (again). I have said *authoring* lines of *this* kind takes a minute per line. Specifically: lines fixing the fallthrough warning mechanically and repeatedly where the compiler tells you to, and doing so full-time for a month. For instance, take the following one from Gustavo. Are you really saying it takes 12 minutes (your number) to write that `break;`? diff --git a/drivers/gpu/drm/via/via_irq.c b/drivers/gpu/drm/via/via_irq.c index 24cc445169e2..a3e0fb5b8671 100644 --- a/drivers/gpu/drm/via/via_irq.c +++ b/drivers/gpu/drm/via/via_irq.c @@ -364,6 +364,7 @@ int via_wait_irq(struct drm_device *dev, void *data, struct drm_file *file_priv) irqwait->request.sequence += atomic_read(&cur_irq->irq_received); irqwait->request.type &= ~_DRM_VBLANK_RELATIVE; + break; case VIA_IRQ_ABSOLUTE: break; default: > I suppose a one line > patch only takes a minute to merge with b4 if no-one reviews or tests > it, but that's not really desirable. I have not said that either. I said reviewing and merging those are noise compared to any complex patch. Testing should be done by the author comparing codegen. > Part of what I'm trying to measure is the "and useful" bit because > that's not a given. It is useful since it makes intent clear. It also catches actual bugs, which is even more valuable. > Well, you know, subsystems are very different in terms of the amount of > patches a maintainer has to process per release cycle of the kernel. > If a maintainer is close to capacity, additional patches, however > trivial, become a problem. If a maintainer has spare cycles, trivial > patches may look easy. First of all, voluntary maintainers choose their own workload. Furthermore, we already measure capacity in the `MAINTAINERS` file: maintainers can state they can only handle a few patches. Finally, if someone does not have time for a trivial patch, they are very unlikely to have any time to review big ones. > You seem to be saying that because you find it easy to merge trivial > patches, everyone should. Again, I have not said anything of the sort. Cheers, Miguel _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply related [flat|nested] 39+ messages in thread
[parent not found: <44005bde-f6d4-5eaa-39b8-1a5efeedb2d3@gmail.com>]
* Re: [PATCH 000/141] Fix fall-through warnings for Clang [not found] ` <44005bde-f6d4-5eaa-39b8-1a5efeedb2d3@gmail.com> @ 2020-11-26 14:53 ` Miguel Ojeda 2020-11-26 15:28 ` Geert Uytterhoeven 0 siblings, 1 reply; 39+ messages in thread From: Miguel Ojeda @ 2020-11-26 14:53 UTC (permalink / raw) To: Edward Cree Cc: alsa-devel, linux-atm-general, reiserfs-devel, linux-iio, linux-wireless, linux-fbdev, dri-devel, Gustavo A. R. Silva, James Bottomley, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, samba-technical, linux-i3c, linux1394-devel, linux-afs, usb-storage, drbd-dev, devel, linux-cifs, rds-devel, Nick Desaulniers, linux-scsi, Nathan Chancellor, linux-rdma, oss-drivers, bridge, linux-security-module, amd-gfx list, linux-stm32, cluster-devel, linux-acpi, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, Jakub Kicinski, Ext4 Developers List, Linux Media Mailing List, Kees Cook, selinux, linux-arm-msm, intel-gfx, linux-geode, linux-can, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, ceph-devel, virtualization, Linux ARM, linux-hwmon, linux-watchdog, linux-nfs, GR-Linux-NIC-Dev, tipc-discussion, Linux-MM, Network Development, linux-decnet-user, linux-mmc, linux-kernel, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), Linux-Renesas, linux-sctp, linux-usb, netfilter-devel, Linux Crypto Mailing List, patches, Joe Perches, linux-integrity, target-devel, linux-hardening On Wed, Nov 25, 2020 at 11:44 PM Edward Cree <ecree.xilinx@gmail.com> wrote: > > To make the intent clear, you have to first be certain that you > understand the intent; otherwise by adding either a break or a > fallthrough to suppress the warning you are just destroying the > information that "the intent of this code is unknown". If you don't know what the intent of your own code is, then you *already* have a problem in your hands. > Figuring out the intent of a piece of unfamiliar code takes more > than 1 minute; just because > case foo: > thing; > case bar: > break; > produces identical code to > case foo: > thing; > break; > case bar: > break; > doesn't mean that *either* is correct — maybe the author meant What takes 1 minute is adding it *mechanically* by the author, i.e. so that you later compare whether codegen is the same. > to write > case foo: > return thing; > case bar: > break; > and by inserting that break you've destroyed the marker that > would direct someone who knew what the code was about to look > at that point in the code and spot the problem. Then it means you already have a bug. This patchset gives the maintainer a chance to notice it, which is a good thing. The "you've destroyed the market" claim is bogus, because: 1. you were not looking into it 2. you didn't notice the bug so far 3. is implicit -- harder to spot 4. is only useful if you explicitly take a look at this kind of bug. So why don't you do it now? > Thus, you *always* have to look at more than just the immediate > mechanical context of the code, to make a proper judgement that > yes, this was the intent. I find that is the responsibility of the maintainers and reviewers for tree-wide patches like this, assuming they want. They can also keep the behavior (and the bugs) without spending time. Their choice. > If you think that that sort of thing > can be done in an *average* time of one minute, then I hope you > stay away from code I'm responsible for! Please don't accuse others of recklessness or incompetence, especially if you didn't understand what they said. > A warning is only useful because it makes you *think* about the > code. If you suppress the warning without doing that thinking, > then you made the warning useless; and if the warning made you > think about code that didn't *need* it, then the warning was > useless from the start. We are not suppressing the warning. Quite the opposite, in fact. > So make your mind up: does Clang's stricter -Wimplicit-fallthrough > flag up code that needs thought (in which case the fixes take > effort both to author and to review) As I said several times already, it does take time to review if the maintainer wants to take the chance to see if they had a bug to begin with, but it does not require thought for the author if they just go for equivalent codegen. > or does it flag up code > that can be mindlessly "fixed" (in which case the warning is > worthless)? Proponents in this thread seem to be trying to > have it both ways. A warning is not worthless just because you can mindlessly fix it. There are many counterexamples, e.g. many checkpatch/lint/lang-format/indentation warnings, functional ones like the `if (a = b)` warning... Cheers, Miguel _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 000/141] Fix fall-through warnings for Clang 2020-11-26 14:53 ` Miguel Ojeda @ 2020-11-26 15:28 ` Geert Uytterhoeven 2020-11-26 17:05 ` Miguel Ojeda 0 siblings, 1 reply; 39+ messages in thread From: Geert Uytterhoeven @ 2020-11-26 15:28 UTC (permalink / raw) To: Miguel Ojeda Cc: ALSA Development Mailing List, bridge, target-devel, linux-iio, linux-wireless, Linux Fbdev development list, dri-devel, virtualization, James Bottomley, linux-ide, dm-devel, keyrings, MTD Maling List, GR-everest-linux-l2, wcn36xx, linux-i3c, linux1394-devel, linux-afs, Lars Ellenberg, driverdevel, linux-cifs, rds-devel, scsi, ACPI Devel Maling List, linux-rdma, oss-drivers, linux-atm-general, ceph-devel, amd-gfx list, linux-stm32, cluster-devel, usb-storage, Linux MMC List, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, Jakub Kicinski, Ext4 Developers List, NetFilter, Linux Media Mailing List, Kees Cook, selinux, linux-arm-msm, Intel Graphics Development, linux-sctp, reiserfs-devel, linux-geode, linux-block, open list:GPIO SUBSYSTEM, op-tee, linux-mediatek, xen-devel, Nouveau Dev, linux-hams, Nathan Chancellor, linux-can, Linux ARM, linux-hwmon, Nick Desaulniers, Linux Watchdog Mailing List, GR-Linux-NIC-Dev, Linux-MM, Network Development, linux-decnet-user, samba-technical, Gustavo A. R. Silva, linux-kernel, Linux-Renesas, Edward Cree, linux-security-module, USB list, tipc-discussion, Linux Crypto Mailing List, patches, Joe Perches, linux-integrity, open list:NFS, SUNRPC, AND..., maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), linux-hardening Hi Miguel, On Thu, Nov 26, 2020 at 3:54 PM Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> wrote: > On Wed, Nov 25, 2020 at 11:44 PM Edward Cree <ecree.xilinx@gmail.com> wrote: > > To make the intent clear, you have to first be certain that you > > understand the intent; otherwise by adding either a break or a > > fallthrough to suppress the warning you are just destroying the > > information that "the intent of this code is unknown". > > If you don't know what the intent of your own code is, then you > *already* have a problem in your hands. The maintainer is not necessarily the owner/author of the code, and thus may not know the intent of the code. > > or does it flag up code > > that can be mindlessly "fixed" (in which case the warning is > > worthless)? Proponents in this thread seem to be trying to > > have it both ways. > > A warning is not worthless just because you can mindlessly fix it. > There are many counterexamples, e.g. many > checkpatch/lint/lang-format/indentation warnings, functional ones like > the `if (a = b)` warning... BTW, you cannot mindlessly fix the latter, as you cannot know if "(a == b)" or "((a = b))" was intended, without understanding the code (and the (possibly unavailable) data sheet, and the hardware, ...). P.S. So far I've stayed out of this thread, as I like it if the compiler flags possible mistakes. After all I was the one fixing new "may be used uninitialized" warnings thrown up by gcc-4.1, until (a bit later than) support for that compiler was removed... Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 000/141] Fix fall-through warnings for Clang 2020-11-26 15:28 ` Geert Uytterhoeven @ 2020-11-26 17:05 ` Miguel Ojeda 0 siblings, 0 replies; 39+ messages in thread From: Miguel Ojeda @ 2020-11-26 17:05 UTC (permalink / raw) To: Geert Uytterhoeven Cc: ALSA Development Mailing List, bridge, target-devel, linux-iio, linux-wireless, Linux Fbdev development list, dri-devel, virtualization, James Bottomley, linux-ide, dm-devel, keyrings, MTD Maling List, GR-everest-linux-l2, wcn36xx, linux-i3c, linux1394-devel, linux-afs, Lars Ellenberg, driverdevel, linux-cifs, rds-devel, scsi, ACPI Devel Maling List, linux-rdma, oss-drivers, linux-atm-general, ceph-devel, amd-gfx list, linux-stm32, cluster-devel, usb-storage, Linux MMC List, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, Jakub Kicinski, Ext4 Developers List, NetFilter, Linux Media Mailing List, Kees Cook, selinux, linux-arm-msm, Intel Graphics Development, linux-sctp, reiserfs-devel, linux-geode, linux-block, open list:GPIO SUBSYSTEM, op-tee, linux-mediatek, xen-devel, Nouveau Dev, linux-hams, Nathan Chancellor, linux-can, Linux ARM, linux-hwmon, Nick Desaulniers, Linux Watchdog Mailing List, GR-Linux-NIC-Dev, Linux-MM, Network Development, linux-decnet-user, samba-technical, Gustavo A. R. Silva, linux-kernel, Linux-Renesas, Edward Cree, linux-security-module, USB list, tipc-discussion, Linux Crypto Mailing List, patches, Joe Perches, linux-integrity, open list:NFS, SUNRPC, AND..., maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), linux-hardening On Thu, Nov 26, 2020 at 4:28 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote: > > The maintainer is not necessarily the owner/author of the code, and > thus may not know the intent of the code. Agreed, I was not blaming maintainers -- just trying to point out that the problem is there :-) In those cases, it is still very useful: we add the `fallthrough` and a comment saying `FIXME: fallthrough intended? Figure this out...`. Thus a previous unknown unknown is now a known unknown. And no new unknown unknowns will be introduced since we enabled the warning globally. > BTW, you cannot mindlessly fix the latter, as you cannot know if > "(a == b)" or "((a = b))" was intended, without understanding the code > (and the (possibly unavailable) data sheet, and the hardware, ...). That's right, I was referring to the cases where the compiler saves someone time from a typo they just made. Cheers, Miguel _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 000/141] Fix fall-through warnings for Clang [not found] ` <4993259d01a0064f8bb22770503490f9252f3659.camel@HansenPartnership.com> 2020-11-25 0:32 ` Miguel Ojeda @ 2020-11-25 10:38 ` Andy Shevchenko 1 sibling, 0 replies; 39+ messages in thread From: Andy Shevchenko @ 2020-11-25 10:38 UTC (permalink / raw) To: James Bottomley Cc: ALSA Development Mailing List, linux-atm-general, reiserfs-devel, linux-iio, linux-wireless, open list:FRAMEBUFFER LAYER, dri-devel, linux-kernel, Nathan Chancellor, linux-ide, device-mapper development, keyrings, open list:MEMORY TECHNOLOGY..., GR-everest-linux-l2, wcn36xx, samba-technical, linux-i3c, linux1394-devel, linux-afs, usb-storage, drbd-dev, open list:STAGING SUBSYSTEM, linux-cifs, rds-devel, Nick Desaulniers, linux-scsi, open list:HFI1 DRIVER, oss-drivers, bridge, linux-security-module, amd-gfx, linux-stm32, cluster-devel, ACPI Devel Maling List, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, Jakub Kicinski, Ext4 Developers List, Linux Media Mailing List, Kees Cook, selinux, linux-arm-msm, intel-gfx, linux-geode, linux-can, linux-block, open list:GPIO SUBSYSTEM, op-tee, moderated list:ARM/Mediatek SoC support, xen-devel, nouveau, linux-hams, ceph-devel, virtualization, Linux ARM, linux-hwmon, linux-watchdog, linux-nfs, GR-Linux-NIC-Dev, tipc-discussion, Linux-MM, Network Development, linux-decnet-user, linux-mmc, Gustavo A. R. Silva, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), Linux-Renesas, Miguel Ojeda, linux-sctp, USB, netfilter-devel, Linux Crypto Mailing List, patches, Joe Perches, linux-integrity, target-devel, linux-hardening On Mon, Nov 23, 2020 at 10:39 PM James Bottomley <James.Bottomley@hansenpartnership.com> wrote: > On Mon, 2020-11-23 at 19:56 +0100, Miguel Ojeda wrote: > > On Mon, Nov 23, 2020 at 4:58 PM James Bottomley > > <James.Bottomley@hansenpartnership.com> wrote: ... > > But if we do the math, for an author, at even 1 minute per line > > change and assuming nothing can be automated at all, it would take 1 > > month of work. For maintainers, a couple of trivial lines is noise > > compared to many other patches. > > So you think a one line patch should take one minute to produce ... I > really don't think that's grounded in reality. I suppose a one line > patch only takes a minute to merge with b4 if no-one reviews or tests > it, but that's not really desirable. In my practice most of the one line patches were either to fix or to introduce quite interesting issues. 1 minute is 2-3 orders less than usually needed for such patches. That's why I don't like churn produced by people who often even didn't compile their useful contributions. -- With Best Regards, Andy Shevchenko _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 000/141] Fix fall-through warnings for Clang [not found] ` <9b57fd4914b46f38d54087d75e072d6e947cb56d.camel@HansenPartnership.com> 2020-11-22 18:25 ` Joe Perches 2020-11-22 20:35 ` Miguel Ojeda @ 2020-11-22 22:10 ` Sam Ravnborg 2 siblings, 0 replies; 39+ messages in thread From: Sam Ravnborg @ 2020-11-22 22:10 UTC (permalink / raw) To: James Bottomley Cc: alsa-devel, bridge, linux-iio, linux-wireless, linux-fbdev, dri-devel, virtualization, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, linux-i3c, linux1394-devel, linux-afs, drbd-dev, devel, linux-cifs, rds-devel, linux-scsi, linux-acpi, linux-rdma, oss-drivers, linux-atm-general, ceph-devel, amd-gfx, linux-stm32, cluster-devel, usb-storage, linux-mmc, coreteam, intel-wired-lan, Gustavo A. R. Silva, linux-input, Miguel Ojeda, Jakub Kicinski, linux-ext4, netfilter-devel, linux-media, Kees Cook, selinux, linux-arm-msm, intel-gfx, linux-sctp, reiserfs-devel, linux-geode, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, Nathan Chancellor, linux-can, linux-arm-kernel, linux-hwmon, Nick Desaulniers, linux-watchdog, GR-Linux-NIC-Dev, linux-mm, netdev, linux-decnet-user, samba-technical, linux-kernel, linux-renesas-soc, linux-security-module, target-devel, tipc-discussion, linux-crypto, patches, Joe Perches, linux-integrity, linux-hardening, linux-nfs, x86, linux-usb Hi James. > > > 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@mail.gmail.com/ > > > Well, it's a problem in an error leg, sure, but it's not a really > compelling reason for a 141 patch series, is it? All that fixing this > error will do is get the driver to print "oh dear there's a problem" > under four more conditions than it previously did. You are asking the wrong question here. Yuo should ask how many hours could have been saved by all the bugs people have been fighting with and then fixed *before* the code hit the kernel at all. My personal experience is that I, more than once, have had errors related to a missing break in my code. So this warnings is IMO a win. And if we are only ~100 patches to have it globally enabled then it is a no-brainer in my book. Sam _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 000/141] Fix fall-through warnings for Clang 2020-11-22 16:17 ` Kees Cook [not found] ` <9b57fd4914b46f38d54087d75e072d6e947cb56d.camel@HansenPartnership.com> @ 2020-11-24 1:32 ` Nick Desaulniers via Virtualization 2020-11-24 21:25 ` Kees Cook 2020-12-01 14:08 ` Dan Carpenter 2020-12-01 14:04 ` Dan Carpenter 2 siblings, 2 replies; 39+ messages in thread From: Nick Desaulniers via Virtualization @ 2020-11-24 1:32 UTC (permalink / raw) To: Kees Cook Cc: alsa-devel, linux-atm-general, reiserfs-devel, linux-iio, linux-wireless, linux-fbdev, dri-devel, LKML, Nathan Chancellor, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, samba-technical, linux-i3c, linux1394-devel, linux-afs, usb-storage, drbd-dev, devel, linux-cifs, rds-devel, linux-scsi, linux-rdma, oss-drivers, bridge, linux-security-module, amd-gfx list, linux-stm32, cluster-devel, linux-acpi, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, Jakub Kicinski, linux-ext4, linux-media, linux-watchdog, selinux, linux-arm-msm, intel-gfx, linux-geode, linux-can, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, ceph-devel, virtualization, Linux ARM, linux-hwmon, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), linux-nfs, GR-Linux-NIC-Dev, tipc-discussion, Linux Memory Management List, Network Development, linux-decnet-user, linux-mmc, Gustavo A. R. Silva, Linux-Renesas, linux-sctp, linux-usb, netfilter-devel, open list:HARDWARE RANDOM NUMBER GENERATOR CORE, patches, Joe Perches, linux-integrity, target-devel, linux-hardening On Sun, Nov 22, 2020 at 8:17 AM Kees Cook <keescook@chromium.org> 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@mail.gmail.com/ 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 _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 000/141] Fix fall-through warnings for Clang 2020-11-24 1:32 ` Nick Desaulniers via Virtualization @ 2020-11-24 21:25 ` Kees Cook 2020-12-01 14:08 ` Dan Carpenter 1 sibling, 0 replies; 39+ messages in thread From: Kees Cook @ 2020-11-24 21:25 UTC (permalink / raw) To: Nick Desaulniers Cc: alsa-devel, linux-atm-general, reiserfs-devel, linux-iio, linux-wireless, linux-fbdev, dri-devel, LKML, Nathan Chancellor, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, samba-technical, linux-i3c, linux1394-devel, linux-afs, usb-storage, drbd-dev, devel, linux-cifs, rds-devel, linux-scsi, linux-rdma, oss-drivers, bridge, linux-security-module, amd-gfx list, linux-stm32, cluster-devel, linux-acpi, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, Jakub Kicinski, linux-ext4, linux-media, linux-watchdog, selinux, linux-arm-msm, intel-gfx, linux-geode, linux-can, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, ceph-devel, virtualization, Linux ARM, linux-hwmon, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), linux-nfs, GR-Linux-NIC-Dev, tipc-discussion, Linux Memory Management List, Network Development, linux-decnet-user, linux-mmc, Gustavo A. R. Silva, Linux-Renesas, linux-sctp, linux-usb, netfilter-devel, open list:HARDWARE RANDOM NUMBER GENERATOR CORE, patches, Joe Perches, linux-integrity, target-devel, linux-hardening On Mon, Nov 23, 2020 at 05:32:51PM -0800, Nick Desaulniers wrote: > On Sun, Nov 22, 2020 at 8:17 AM Kees Cook <keescook@chromium.org> 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@mail.gmail.com/ > > 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 I still think this isn't right -- it's a case statement that runs off the end without an explicit flow control determination. I think Clang is right to warn for these, and GCC should also warn. -- Kees Cook _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 000/141] Fix fall-through warnings for Clang 2020-11-24 1:32 ` Nick Desaulniers via Virtualization 2020-11-24 21:25 ` Kees Cook @ 2020-12-01 14:08 ` Dan Carpenter 1 sibling, 0 replies; 39+ messages in thread From: Dan Carpenter @ 2020-12-01 14:08 UTC (permalink / raw) To: Nick Desaulniers Cc: alsa-devel, bridge, target-devel, linux-iio, linux-wireless, linux-fbdev, dri-devel, virtualization, Linux Memory Management List, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, linux-i3c, linux1394-devel, linux-afs, linux-watchdog, devel, linux-cifs, rds-devel, linux-scsi, linux-acpi, linux-rdma, oss-drivers, linux-atm-general, ceph-devel, amd-gfx list, linux-stm32, cluster-devel, usb-storage, linux-mmc, coreteam, intel-wired-lan, Gustavo A. R. Silva, linux-input, Miguel Ojeda, Jakub Kicinski, linux-ext4, netfilter-devel, linux-media, Kees Cook, selinux, linux-arm-msm, intel-gfx, linux-sctp, reiserfs-devel, linux-geode, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, drbd-dev, linux-hams, Nathan Chancellor, linux-can, Linux ARM, linux-hwmon, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), linux-nfs, GR-Linux-NIC-Dev, nouveau, Network Development, linux-decnet-user, samba-technical, LKML, Linux-Renesas, linux-security-module, linux-usb, tipc-discussion, open list:HARDWARE RANDOM NUMBER GENERATOR CORE, patches, Joe Perches, linux-integrity, linux-hardening On Mon, Nov 23, 2020 at 05:32:51PM -0800, Nick Desaulniers wrote: > On Sun, Nov 22, 2020 at 8:17 AM Kees Cook <keescook@chromium.org> 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@mail.gmail.com/ > > So looks like the bulk of these are: > switch (x) { > case 0: > ++x; > default: > break; > } This should not generate a warning. > > 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:; This should generate a warning. > > switch (x) { > case 0: > ++x; > default: > return; > } Warn for this. > > switch (x) { > case 0: > ++x; > default: > ; > } Don't warn for this. If adding a break statement changes the flow of the code then warn about potentially missing break statements, but if it doesn't change anything then don't warn about it. regards, dan carpenter _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 000/141] Fix fall-through warnings for Clang 2020-11-22 16:17 ` Kees Cook [not found] ` <9b57fd4914b46f38d54087d75e072d6e947cb56d.camel@HansenPartnership.com> 2020-11-24 1:32 ` Nick Desaulniers via Virtualization @ 2020-12-01 14:04 ` Dan Carpenter 2 siblings, 0 replies; 39+ messages in thread From: Dan Carpenter @ 2020-12-01 14:04 UTC (permalink / raw) To: Kees Cook Cc: alsa-devel, bridge, target-devel, linux-iio, linux-wireless, linux-fbdev, dri-devel, virtualization, linux-mm, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, linux-i3c, linux1394-devel, linux-afs, devel, linux-cifs, rds-devel, linux-scsi, linux-acpi, linux-rdma, oss-drivers, linux-atm-general, ceph-devel, amd-gfx, linux-stm32, cluster-devel, usb-storage, linux-mmc, coreteam, intel-wired-lan, Gustavo A. R. Silva, linux-input, Miguel Ojeda, Jakub Kicinski, linux-ext4, netfilter-devel, linux-media, linux-watchdog, selinux, linux-arm-msm, intel-gfx, linux-sctp, reiserfs-devel, linux-geode, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, drbd-dev, linux-hams, Nathan Chancellor, linux-can, linux-arm-kernel, linux-hwmon, Nick Desaulniers, linux-nfs, GR-Linux-NIC-Dev, nouveau, netdev, linux-decnet-user, samba-technical, linux-kernel, linux-renesas-soc, linux-security-module, linux-usb, tipc-discussion, linux-crypto, patches, Joe Perches, linux-integrity, x86, linux-hardening On Sun, Nov 22, 2020 at 08:17:03AM -0800, Kees Cook wrote: > 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@mail.gmail.com/ This is a fallthrough to a return and not to a break. That should trigger a warning. The fallthrough to a break should not generate a warning. The bug we're trying to fix is "missing break statement" but if the result of the bug is "we hit a break statement" then now we're just talking about style. GCC should limit itself to warning about potentially buggy code. regards, dan carpenter _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 000/141] Fix fall-through warnings for Clang [not found] <cover.1605896059.git.gustavoars@kernel.org> 2020-11-20 18:28 ` [PATCH 000/141] Fix fall-through warnings for Clang Joe Perches [not found] ` <20201120105344.4345c14e@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> @ 2020-11-20 22:21 ` Miguel Ojeda 2020-11-23 20:38 ` Mark Brown ` (3 subsequent siblings) 6 siblings, 0 replies; 39+ messages in thread From: Miguel Ojeda @ 2020-11-20 22:21 UTC (permalink / raw) To: Gustavo A. R. Silva Cc: alsa-devel, linux-atm-general, reiserfs-devel, linux-iio, linux-wireless, linux-fbdev, dri-devel, virtualization, Nathan Chancellor, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, samba-technical, linux-i3c, linux1394-devel, linux-afs, usb-storage, drbd-dev, devel, linux-cifs, rds-devel, Nick Desaulniers, linux-scsi, linux-rdma, oss-drivers, bridge, linux-security-module, amd-gfx, linux-stm32, cluster-devel, linux-acpi, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, tipc-discussion, Ext4 Developers List, Linux Media Mailing List, linux-watchdog, selinux, linux-arm-msm, intel-gfx, linux-geode, linux-can, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, nouveau, linux-hams, ceph-devel, Linux ARM, linux-hwmon, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), linux-nfs, GR-Linux-NIC-Dev, Kees Cook, Linux-MM, Network Development, linux-decnet-user, linux-mmc, linux-kernel, linux-renesas-soc, linux-sctp, linux-usb, netfilter-devel, Linux Crypto Mailing List, patches, Joe Perches, linux-integrity, target-devel, linux-hardening Hi Gustavo, On Fri, Nov 20, 2020 at 7:21 PM Gustavo A. R. Silva <gustavoars@kernel.org> wrote: > > Hi all, > > This series aims to fix almost all remaining fall-through warnings in > order to enable -Wimplicit-fallthrough for Clang. Thanks for this. Since this warning is reliable in both/all compilers and we are eventually getting rid of all the cases, what about going even further and making it an error right after? Cheers, Miguel _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 000/141] Fix fall-through warnings for Clang [not found] <cover.1605896059.git.gustavoars@kernel.org> ` (2 preceding siblings ...) 2020-11-20 22:21 ` Miguel Ojeda @ 2020-11-23 20:38 ` Mark Brown 2020-12-01 5:52 ` Martin K. Petersen ` (2 subsequent siblings) 6 siblings, 0 replies; 39+ messages in thread From: Mark Brown @ 2020-11-23 20:38 UTC (permalink / raw) To: linux-kernel, Gustavo A. R. Silva Cc: linux-watchdog, alsa-devel, linux-atm-general, usb-storage, Nick Desaulniers, rnel.org, dri-devel, virtualization, linux-mm, linux-sctp, target-devel, linux-mtd, linux-hardening, op-tee, wcn36xx, linux-i3c, linux1394-devel, linux-afs, drbd-dev, devel, linux-cifs, rds-devel, linux-scsi, linux-acpi, linux-rdma, bridge, ceph-devel, amd-gfx, linux-stm32, cluster-devel, oss-drivers, linux-mmc, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, xen-devel, linux-ext4, linux-media, l, Kees Cook, selinux, linux-arm-msm, intel-gfx, reiserfs-devel, linux-geode, linux-block, linux-gpio, linux-mediatek, samba-technical, linux-fbdev, inux-ide, nouveau, linux-hams, Nathan Chancellor, linux-can, linux-arm-kernel, linux-hwmon, x86, linux-nfs, GR-Linux-NIC-Dev, e.org, netfilter-devel, linux-decnet-user, patches, linux-usb, linux-wireless, dm-devel, linux-iio, linux-renesas-soc, linux-security-module, keyrings, tipc-discussion, linux-crypto, netdev, Joe Perches, linux-integrity, GR-everest-linux-l2 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. > > [...] Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next Thanks! [1/1] regulator: as3722: Fix fall-through warnings for Clang commit: b52b417ccac4fae5b1f2ec4f1d46eb91e4493dc5 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 000/141] Fix fall-through warnings for Clang [not found] <cover.1605896059.git.gustavoars@kernel.org> ` (3 preceding siblings ...) 2020-11-23 20:38 ` Mark Brown @ 2020-12-01 5:52 ` Martin K. Petersen 2020-12-08 4:52 ` (subset) " Martin K. Petersen [not found] ` <cb9b9534572bc476f4fb7b49a73dc8646b780c84.1605896060.git.gustavoars@kernel.org> 6 siblings, 0 replies; 39+ messages in thread From: Martin K. Petersen @ 2020-12-01 5:52 UTC (permalink / raw) To: Gustavo A. R. Silva Cc: alsa-devel, linux-atm-general, reiserfs-devel, nouveau, linux-iio, linux-wireless, linux-fbdev, dri-devel, virtualization, Nathan Chancellor, linux-ide, dm-devel, keyrings, linux-mtd, GR-everest-linux-l2, wcn36xx, samba-technical, linux-i3c, linux1394-devel, linux-afs, usb-storage, target-devel, devel, linux-cifs, rds-devel, Nick Desaulniers, linux-scsi, linux-rdma, oss-drivers, bridge, linux-security-module, amd-gfx, linux-stm32, cluster-devel, linux-acpi, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, tipc-discussion, linux-ext4, linux-media, linux-watchdog, selinux, linux-arm-msm, intel-gfx, linux-geode, linux-can, linux-block, linux-gpio, op-tee, linux-mediatek, xen-devel, drbd-dev, linux-hams, ceph-devel, linux-arm-kernel, linux-hwmon, x86, linux-nfs, GR-Linux-NIC-Dev, Kees Cook, linux-mm, netdev, linux-decnet-user, linux-mmc, linux-kernel, linux-renesas-soc, linux-sctp, linux-usb, netfilter-devel, linux-crypto, patches, Joe Perches, linux-integrity, linux-hardening Gustavo, > This series aims to fix almost all remaining fall-through warnings in > order to enable -Wimplicit-fallthrough for Clang. Applied 20-22,54,120-124 to 5.11/scsi-staging, thanks. -- Martin K. Petersen Oracle Linux Engineering _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: (subset) [PATCH 000/141] Fix fall-through warnings for Clang [not found] <cover.1605896059.git.gustavoars@kernel.org> ` (4 preceding siblings ...) 2020-12-01 5:52 ` Martin K. Petersen @ 2020-12-08 4:52 ` Martin K. Petersen [not found] ` <cb9b9534572bc476f4fb7b49a73dc8646b780c84.1605896060.git.gustavoars@kernel.org> 6 siblings, 0 replies; 39+ messages in thread From: Martin K. Petersen @ 2020-12-08 4:52 UTC (permalink / raw) To: linux-kernel, Gustavo A. R. Silva Cc: linux-fbdev, linux-atm-general, linux-stm32, linux-iio, linux-wireless, alsa-devel, dri-devel, virtualization, linux-mm, linux-ide, dm-devel, keyrings, linux-mtd, linux-hardening, wcn36xx, linux-i3c, linux-decnet-user, ceph-devel, usb-storage, Kees Cook, devel, linux-cifs, rds-devel, linux1394-devel, linux-scsi, linux-rdma, oss-drivers, x86, amd-gfx, linux-afs, cluster-devel, linux-acpi, coreteam, intel-wired-lan, linux-input, Miguel Ojeda, xen-devel, linux-ext4, linux-media, bridge, linux-watchdog, selinux, linux-arm-msm, intel-gfx, reiserfs-devel, linux-geode, linux-block, linux-gpio, op-tee, linux-mediatek, samba-technical, drbd-dev, linux-hams, Nathan Chancellor, linux-can, linux-arm-kernel, linux-hwmon, linux-mmc, linux-nfs, GR-Linux-NIC-Dev, tipc-discussion, Martin K . Petersen, nouveau, patches, linux-usb, Nick Desaulniers, linux-sctp, linux-renesas-soc, linux-security-module, target-devel, netfilter-devel, linux-crypto, netdev, Joe Perches, linux-integrity, GR-everest-linux-l2 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. > > [...] Applied to 5.11/scsi-queue, thanks! [054/141] target: Fix fall-through warnings for Clang https://git.kernel.org/mkp/scsi/c/492096ecfa39 -- Martin K. Petersen Oracle Linux Engineering _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
[parent not found: <cb9b9534572bc476f4fb7b49a73dc8646b780c84.1605896060.git.gustavoars@kernel.org>]
* Re: [PATCH 136/141] virtio_net: Fix fall-through warnings for Clang [not found] ` <cb9b9534572bc476f4fb7b49a73dc8646b780c84.1605896060.git.gustavoars@kernel.org> @ 2021-02-02 14:08 ` Gustavo A. R. Silva 0 siblings, 0 replies; 39+ messages in thread From: Gustavo A. R. Silva @ 2021-02-02 14:08 UTC (permalink / raw) To: Gustavo A. R. Silva, Michael S. Tsirkin, Jason Wang, David S. Miller, Jakub Kicinski Cc: netdev, linux-hardening, linux-kernel, virtualization Hi all, Who can take this? :) Thanks -- Gustavo On 11/20/20 12:40, Gustavo A. R. Silva wrote: > In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning > by explicitly adding a goto statement instead of letting the code fall > through to the next case. > > Link: https://github.com/KSPP/linux/issues/115 > Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> > --- > drivers/net/virtio_net.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index 21b71148c532..fd326dc586aa 100644 > --- a/drivers/net/virtio_net.c > +++ b/drivers/net/virtio_net.c > @@ -732,6 +732,7 @@ static struct sk_buff *receive_small(struct net_device *dev, > fallthrough; > case XDP_ABORTED: > trace_xdp_exception(vi->dev, xdp_prog, act); > + goto err_xdp; > case XDP_DROP: > goto err_xdp; > } > _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 39+ messages in thread
end of thread, other threads:[~2021-02-02 14:34 UTC | newest]
Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <cover.1605896059.git.gustavoars@kernel.org>
2020-11-20 18:28 ` [PATCH 000/141] Fix fall-through warnings for Clang Joe Perches
2020-11-20 19:02 ` Gustavo A. R. Silva
[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
[not found] ` <20201120115142.292999b2@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
2020-11-20 20:48 ` Kees Cook
2020-11-22 16:17 ` Kees Cook
[not found] ` <9b57fd4914b46f38d54087d75e072d6e947cb56d.camel@HansenPartnership.com>
2020-11-22 18:25 ` Joe Perches
[not found] ` <0147972a72bc13f3629de8a32dee6f1f308994b5.camel@HansenPartnership.com>
2020-11-22 19:22 ` Joe Perches
[not found] ` <dbd2cb703ed9eefa7dde9281ea26ab0f7acc8afe.camel@HansenPartnership.com>
[not found] ` <20201123130348.GA3119@embeddedor>
[not found] ` <8f5611bb015e044fa1c0a48147293923c2d904e4.camel@HansenPartnership.com>
2020-11-24 21:32 ` [Intel-wired-lan] " Kees Cook
[not found] ` <alpine.LNX.2.23.453.2011250859290.15@nippy.intranet>
2020-11-24 23:15 ` Miguel Ojeda
[not found] ` <alpine.LNX.2.23.453.2011251022550.14@nippy.intranet>
2020-11-25 1:05 ` Miguel Ojeda
[not found] ` <a841536fe65bb33f1c72ce2455a6eb47a0107565.camel@HansenPartnership.com>
2020-11-25 12:24 ` Nick Desaulniers via Virtualization
[not found] ` <20201125082405.1d8c23dc@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
2020-11-25 17:04 ` Miguel Ojeda
2020-11-25 22:09 ` Nick Desaulniers via Virtualization
[not found] ` <alpine.LNX.2.23.453.2011260750300.6@nippy.intranet>
2020-11-25 22:09 ` Nick Desaulniers via Virtualization
2020-11-25 21:10 ` Kees Cook
2020-11-22 20:35 ` Miguel Ojeda
[not found] ` <alpine.LNX.2.23.453.2011230938390.7@nippy.intranet>
2020-11-23 14:05 ` Miguel Ojeda
[not found] ` <alpine.LNX.2.23.453.2011241036520.7@nippy.intranet>
2020-11-24 1:05 ` Joe Perches
2020-11-24 23:46 ` Miguel Ojeda
[not found] ` <1c7d7fde126bc0acf825766de64bf2f9b888f216.camel@HansenPartnership.com>
2020-11-23 14:19 ` 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
[not found] ` <4993259d01a0064f8bb22770503490f9252f3659.camel@HansenPartnership.com>
2020-11-25 0:32 ` Miguel Ojeda
[not found] ` <44005bde-f6d4-5eaa-39b8-1a5efeedb2d3@gmail.com>
2020-11-26 14:53 ` Miguel Ojeda
2020-11-26 15:28 ` Geert Uytterhoeven
2020-11-26 17:05 ` Miguel Ojeda
2020-11-25 10:38 ` Andy Shevchenko
2020-11-22 22:10 ` Sam Ravnborg
2020-11-24 1:32 ` Nick Desaulniers via Virtualization
2020-11-24 21:25 ` Kees Cook
2020-12-01 14:08 ` Dan Carpenter
2020-12-01 14:04 ` Dan Carpenter
2020-11-20 22:21 ` Miguel Ojeda
2020-11-23 20:38 ` Mark Brown
2020-12-01 5:52 ` Martin K. Petersen
2020-12-08 4:52 ` (subset) " Martin K. Petersen
[not found] ` <cb9b9534572bc476f4fb7b49a73dc8646b780c84.1605896060.git.gustavoars@kernel.org>
2021-02-02 14:08 ` [PATCH 136/141] virtio_net: " Gustavo A. R. Silva
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).