driverdev-devel.linuxdriverproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 000/141] Fix fall-through warnings for Clang
@ 2020-11-20 18:21 Gustavo A. R. Silva
  2020-11-20 18:27 ` [PATCH 023/141] staging: rtl8723bs: core: " Gustavo A. R. Silva
                   ` (11 more replies)
  0 siblings, 12 replies; 47+ messages in thread
From: Gustavo A. R. Silva @ 2020-11-20 18:21 UTC (permalink / raw)
  To: 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, Gustavo A. R. Silva,
	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, Joe Perches,
	linux-integrity, target-devel, linux-hardening

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.

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].

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].

I'm happy to carry this whole series in my own tree if people are OK
with it. :)

[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 A. R. Silva (141):
  afs: Fix fall-through warnings for Clang
  ASoC: codecs: Fix fall-through warnings for Clang
  cifs: Fix fall-through warnings for Clang
  drm/amdgpu: Fix fall-through warnings for Clang
  drm/radeon: Fix fall-through warnings for Clang
  gfs2: Fix fall-through warnings for Clang
  gpio: Fix fall-through warnings for Clang
  IB/hfi1: Fix fall-through warnings for Clang
  igb: Fix fall-through warnings for Clang
  ima: Fix fall-through warnings for Clang
  ipv4: Fix fall-through warnings for Clang
  ixgbe: Fix fall-through warnings for Clang
  media: dvb-frontends: Fix fall-through warnings for Clang
  media: usb: dvb-usb-v2: Fix fall-through warnings for Clang
  netfilter: Fix fall-through warnings for Clang
  nfsd: Fix fall-through warnings for Clang
  nfs: Fix fall-through warnings for Clang
  qed: Fix fall-through warnings for Clang
  qlcnic: Fix fall-through warnings for Clang
  scsi: aic7xxx: Fix fall-through warnings for Clang
  scsi: aic94xx: Fix fall-through warnings for Clang
  scsi: bfa: Fix fall-through warnings for Clang
  staging: rtl8723bs: core: Fix fall-through warnings for Clang
  staging: vt6655: Fix fall-through warnings for Clang
  bnxt_en: Fix fall-through warnings for Clang
  ceph: Fix fall-through warnings for Clang
  drbd: Fix fall-through warnings for Clang
  drm/amd/display: Fix fall-through warnings for Clang
  e1000: Fix fall-through warnings for Clang
  ext2: Fix fall-through warnings for Clang
  ext4: Fix fall-through warnings for Clang
  floppy: Fix fall-through warnings for Clang
  fm10k: Fix fall-through warnings for Clang
  IB/mlx4: Fix fall-through warnings for Clang
  IB/qedr: Fix fall-through warnings for Clang
  ice: Fix fall-through warnings for Clang
  Input: pcspkr - Fix fall-through warnings for Clang
  isofs: Fix fall-through warnings for Clang
  ixgbevf: Fix fall-through warnings for Clang
  kprobes/x86: Fix fall-through warnings for Clang
  mm: Fix fall-through warnings for Clang
  net: 3c509: Fix fall-through warnings for Clang
  net: cassini: Fix fall-through warnings for Clang
  net/mlx4: Fix fall-through warnings for Clang
  net: mscc: ocelot: Fix fall-through warnings for Clang
  netxen_nic: Fix fall-through warnings for Clang
  nfp: Fix fall-through warnings for Clang
  perf/x86: Fix fall-through warnings for Clang
  pinctrl: Fix fall-through warnings for Clang
  RDMA/mlx5: Fix fall-through warnings for Clang
  reiserfs: Fix fall-through warnings for Clang
  security: keys: Fix fall-through warnings for Clang
  selinux: Fix fall-through warnings for Clang
  target: Fix fall-through warnings for Clang
  uprobes/x86: Fix fall-through warnings for Clang
  vxge: Fix fall-through warnings for Clang
  watchdog: Fix fall-through warnings for Clang
  xen-blkfront: Fix fall-through warnings for Clang
  regulator: as3722: Fix fall-through warnings for Clang
  habanalabs: Fix fall-through warnings for Clang
  tee: Fix fall-through warnings for Clang
  HID: usbhid: Fix fall-through warnings for Clang
  HID: input: Fix fall-through warnings for Clang
  ACPI: Fix fall-through warnings for Clang
  airo: Fix fall-through warnings for Clang
  ALSA: hdspm: Fix fall-through warnings for Clang
  ALSA: pcsp: Fix fall-through warnings for Clang
  ALSA: sb: Fix fall-through warnings for Clang
  ath5k: Fix fall-through warnings for Clang
  atm: fore200e: Fix fall-through warnings for Clang
  braille_console: Fix fall-through warnings for Clang
  can: peak_usb: Fix fall-through warnings for Clang
  carl9170: Fix fall-through warnings for Clang
  cfg80211: Fix fall-through warnings for Clang
  crypto: ccree - Fix fall-through warnings for Clang
  decnet: Fix fall-through warnings for Clang
  dm raid: Fix fall-through warnings for Clang
  drm/amd/pm: Fix fall-through warnings for Clang
  drm: Fix fall-through warnings for Clang
  drm/i915/gem: Fix fall-through warnings for Clang
  drm/nouveau/clk: Fix fall-through warnings for Clang
  drm/nouveau: Fix fall-through warnings for Clang
  drm/nouveau/therm: Fix fall-through warnings for Clang
  drm/via: Fix fall-through warnings for Clang
  firewire: core: Fix fall-through warnings for Clang
  hwmon: (corsair-cpro) Fix fall-through warnings for Clang
  hwmon: (max6621) Fix fall-through warnings for Clang
  i3c: master: cdns: Fix fall-through warnings for Clang
  ide: Fix fall-through warnings for Clang
  iio: adc: cpcap: Fix fall-through warnings for Clang
  iwlwifi: iwl-drv: Fix fall-through warnings for Clang
  libata: Fix fall-through warnings for Clang
  mac80211: Fix fall-through warnings for Clang
  media: atomisp: Fix fall-through warnings for Clang
  media: dvb_frontend: Fix fall-through warnings for Clang
  media: rcar_jpu: Fix fall-through warnings for Clang
  media: saa7134: Fix fall-through warnings for Clang
  mmc: sdhci-of-arasan: Fix fall-through warnings for Clang
  mt76: mt7615: Fix fall-through warnings for Clang
  mtd: cfi: Fix fall-through warnings for Clang
  mtd: mtdchar: Fix fall-through warnings for Clang
  mtd: onenand: Fix fall-through warnings for Clang
  mtd: rawnand: fsmc: Fix fall-through warnings for Clang
  mtd: rawnand: stm32_fmc2: Fix fall-through warnings for Clang
  net: ax25: Fix fall-through warnings for Clang
  net: bridge: Fix fall-through warnings for Clang
  net: core: Fix fall-through warnings for Clang
  netfilter: ipt_REJECT: Fix fall-through warnings for Clang
  net: netrom: Fix fall-through warnings for Clang
  net/packet: Fix fall-through warnings for Clang
  net: plip: Fix fall-through warnings for Clang
  net: rose: Fix fall-through warnings for Clang
  nl80211: Fix fall-through warnings for Clang
  phy: qcom-usb-hs: Fix fall-through warnings for Clang
  rds: Fix fall-through warnings for Clang
  rt2x00: Fix fall-through warnings for Clang
  rtl8xxxu: Fix fall-through warnings for Clang
  rtw88: Fix fall-through warnings for Clang
  rxrpc: Fix fall-through warnings for Clang
  scsi: aacraid: Fix fall-through warnings for Clang
  scsi: aha1740: Fix fall-through warnings for Clang
  scsi: csiostor: Fix fall-through warnings for Clang
  scsi: lpfc: Fix fall-through warnings for Clang
  scsi: stex: Fix fall-through warnings for Clang
  sctp: Fix fall-through warnings for Clang
  slimbus: messaging: Fix fall-through warnings for Clang
  staging: qlge: Fix fall-through warnings for Clang
  staging: vt6656: Fix fall-through warnings for Clang
  SUNRPC: Fix fall-through warnings for Clang
  tipc: Fix fall-through warnings for Clang
  tpm: Fix fall-through warnings for Clang
  ubi: Fix fall-through warnings for Clang
  usb: Fix fall-through warnings for Clang
  video: fbdev: lxfb_ops: Fix fall-through warnings for Clang
  video: fbdev: pm2fb: Fix fall-through warnings for Clang
  virtio_net: Fix fall-through warnings for Clang
  wcn36xx: Fix fall-through warnings for Clang
  xen/manage: Fix fall-through warnings for Clang
  xfrm: Fix fall-through warnings for Clang
  zd1201: Fix fall-through warnings for Clang
  Input: libps2 - Fix fall-through warnings for Clang

 arch/x86/events/core.c                                    | 2 +-
 arch/x86/kernel/kprobes/core.c                            | 1 +
 arch/x86/kernel/uprobes.c                                 | 2 ++
 drivers/accessibility/braille/braille_console.c           | 1 +
 drivers/acpi/sbshc.c                                      | 1 +
 drivers/ata/libata-eh.c                                   | 1 +
 drivers/atm/fore200e.c                                    | 1 +
 drivers/block/drbd/drbd_receiver.c                        | 1 +
 drivers/block/drbd/drbd_req.c                             | 1 +
 drivers/block/floppy.c                                    | 1 +
 drivers/block/xen-blkfront.c                              | 1 +
 drivers/char/tpm/eventlog/tpm1.c                          | 1 +
 drivers/crypto/ccree/cc_cipher.c                          | 3 +++
 drivers/firewire/core-topology.c                          | 1 +
 drivers/gpio/gpio-ath79.c                                 | 1 +
 drivers/gpio/gpiolib-acpi.c                               | 1 +
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c                    | 1 +
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c                     | 1 +
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c                     | 1 +
 drivers/gpu/drm/amd/amdgpu/vi.c                           | 1 +
 drivers/gpu/drm/amd/display/dc/bios/bios_parser.c         | 1 +
 drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c        | 2 ++
 drivers/gpu/drm/amd/display/dc/core/dc_link.c             | 1 +
 drivers/gpu/drm/amd/pm/powerplay/si_dpm.c                 | 2 +-
 .../gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c    | 1 +
 drivers/gpu/drm/drm_bufs.c                                | 1 +
 drivers/gpu/drm/i915/gem/i915_gem_shrinker.c              | 1 +
 drivers/gpu/drm/nouveau/nouveau_bo.c                      | 1 +
 drivers/gpu/drm/nouveau/nouveau_connector.c               | 1 +
 drivers/gpu/drm/nouveau/nvkm/subdev/clk/nv50.c            | 1 +
 drivers/gpu/drm/nouveau/nvkm/subdev/therm/gf119.c         | 1 +
 drivers/gpu/drm/radeon/ci_dpm.c                           | 2 +-
 drivers/gpu/drm/radeon/r300.c                             | 1 +
 drivers/gpu/drm/radeon/si_dpm.c                           | 2 +-
 drivers/gpu/drm/via/via_irq.c                             | 1 +
 drivers/hid/hid-input.c                                   | 1 +
 drivers/hid/usbhid/hid-core.c                             | 2 ++
 drivers/hwmon/corsair-cpro.c                              | 1 +
 drivers/hwmon/max6621.c                                   | 2 +-
 drivers/i3c/master/i3c-master-cdns.c                      | 2 ++
 drivers/ide/siimage.c                                     | 1 +
 drivers/iio/adc/cpcap-adc.c                               | 1 +
 drivers/infiniband/hw/hfi1/qp.c                           | 1 +
 drivers/infiniband/hw/hfi1/tid_rdma.c                     | 5 +++++
 drivers/infiniband/hw/mlx4/mad.c                          | 1 +
 drivers/infiniband/hw/mlx5/qp.c                           | 1 +
 drivers/infiniband/hw/qedr/main.c                         | 1 +
 drivers/input/misc/pcspkr.c                               | 1 +
 drivers/input/serio/libps2.c                              | 2 +-
 drivers/md/dm-raid.c                                      | 1 +
 drivers/media/dvb-core/dvb_frontend.c                     | 1 +
 drivers/media/dvb-frontends/cx24120.c                     | 1 +
 drivers/media/dvb-frontends/dib0090.c                     | 2 ++
 drivers/media/dvb-frontends/drxk_hard.c                   | 1 +
 drivers/media/dvb-frontends/m88rs2000.c                   | 1 +
 drivers/media/pci/saa7134/saa7134-tvaudio.c               | 1 +
 drivers/media/platform/rcar_jpu.c                         | 1 +
 drivers/media/usb/dvb-usb-v2/af9015.c                     | 1 +
 drivers/media/usb/dvb-usb-v2/lmedm04.c                    | 1 +
 drivers/misc/habanalabs/gaudi/gaudi.c                     | 1 +
 drivers/mmc/host/sdhci-of-arasan.c                        | 4 ++++
 drivers/mtd/chips/cfi_cmdset_0001.c                       | 1 +
 drivers/mtd/chips/cfi_cmdset_0002.c                       | 2 ++
 drivers/mtd/chips/cfi_cmdset_0020.c                       | 2 ++
 drivers/mtd/mtdchar.c                                     | 1 +
 drivers/mtd/nand/onenand/onenand_samsung.c                | 1 +
 drivers/mtd/nand/raw/fsmc_nand.c                          | 1 +
 drivers/mtd/nand/raw/stm32_fmc2_nand.c                    | 2 ++
 drivers/mtd/ubi/build.c                                   | 1 +
 drivers/net/can/usb/peak_usb/pcan_usb_core.c              | 2 ++
 drivers/net/ethernet/3com/3c509.c                         | 1 +
 drivers/net/ethernet/broadcom/bnxt/bnxt.c                 | 1 +
 drivers/net/ethernet/intel/e1000/e1000_hw.c               | 1 +
 drivers/net/ethernet/intel/fm10k/fm10k_mbx.c              | 2 ++
 drivers/net/ethernet/intel/ice/ice_txrx_lib.c             | 1 +
 drivers/net/ethernet/intel/igb/e1000_phy.c                | 1 +
 drivers/net/ethernet/intel/igb/igb_ethtool.c              | 1 +
 drivers/net/ethernet/intel/igb/igb_ptp.c                  | 1 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c            | 2 ++
 drivers/net/ethernet/intel/ixgbe/ixgbe_common.c           | 1 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c              | 1 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c              | 1 +
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c         | 1 +
 drivers/net/ethernet/mellanox/mlx4/resource_tracker.c     | 1 +
 drivers/net/ethernet/mscc/ocelot_vcap.c                   | 1 +
 drivers/net/ethernet/neterion/vxge/vxge-config.c          | 1 +
 drivers/net/ethernet/netronome/nfp/nfp_net_repr.c         | 1 +
 drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c      | 1 +
 drivers/net/ethernet/qlogic/qed/qed_l2.c                  | 1 +
 drivers/net/ethernet/qlogic/qed/qed_sriov.c               | 1 +
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c            | 1 +
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c          | 1 +
 drivers/net/ethernet/sun/cassini.c                        | 1 +
 drivers/net/plip/plip.c                                   | 2 ++
 drivers/net/virtio_net.c                                  | 1 +
 drivers/net/wireless/ath/ath5k/mac80211-ops.c             | 1 +
 drivers/net/wireless/ath/carl9170/tx.c                    | 1 +
 drivers/net/wireless/ath/wcn36xx/smd.c                    | 2 +-
 drivers/net/wireless/cisco/airo.c                         | 1 +
 drivers/net/wireless/intel/iwlwifi/iwl-drv.c              | 2 +-
 drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c        | 2 +-
 drivers/net/wireless/ralink/rt2x00/rt2x00queue.c          | 1 +
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c     | 8 ++++----
 drivers/net/wireless/realtek/rtw88/fw.c                   | 2 +-
 drivers/net/wireless/zydas/zd1201.c                       | 2 +-
 drivers/phy/qualcomm/phy-qcom-usb-hs.c                    | 1 +
 drivers/pinctrl/renesas/pinctrl-rza1.c                    | 1 +
 drivers/regulator/as3722-regulator.c                      | 3 ++-
 drivers/scsi/aacraid/commsup.c                            | 1 +
 drivers/scsi/aha1740.c                                    | 1 +
 drivers/scsi/aic7xxx/aic79xx_core.c                       | 4 +++-
 drivers/scsi/aic7xxx/aic7xxx_core.c                       | 4 ++--
 drivers/scsi/aic94xx/aic94xx_scb.c                        | 2 ++
 drivers/scsi/aic94xx/aic94xx_task.c                       | 2 ++
 drivers/scsi/bfa/bfa_fcs_lport.c                          | 2 +-
 drivers/scsi/bfa/bfa_ioc.c                                | 6 ++++--
 drivers/scsi/csiostor/csio_wr.c                           | 1 +
 drivers/scsi/lpfc/lpfc_bsg.c                              | 1 +
 drivers/scsi/stex.c                                       | 1 +
 drivers/slimbus/messaging.c                               | 1 +
 drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c   | 1 +
 drivers/staging/qlge/qlge_main.c                          | 1 +
 drivers/staging/rtl8723bs/core/rtw_cmd.c                  | 1 +
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c             | 1 +
 drivers/staging/rtl8723bs/core/rtw_wlan_util.c            | 1 +
 drivers/staging/vt6655/device_main.c                      | 1 +
 drivers/staging/vt6655/rxtx.c                             | 2 ++
 drivers/staging/vt6656/main_usb.c                         | 1 +
 drivers/target/target_core_iblock.c                       | 1 +
 drivers/target/target_core_pr.c                           | 1 +
 drivers/tee/tee_core.c                                    | 1 +
 drivers/usb/gadget/function/f_fs.c                        | 2 ++
 drivers/usb/gadget/function/f_loopback.c                  | 2 +-
 drivers/usb/gadget/function/f_sourcesink.c                | 1 +
 drivers/usb/gadget/udc/dummy_hcd.c                        | 2 ++
 drivers/usb/host/fotg210-hcd.c                            | 2 +-
 drivers/usb/host/isp116x-hcd.c                            | 1 +
 drivers/usb/host/max3421-hcd.c                            | 1 +
 drivers/usb/host/oxu210hp-hcd.c                           | 1 +
 drivers/usb/misc/yurex.c                                  | 1 +
 drivers/usb/musb/tusb6010.c                               | 1 +
 drivers/usb/storage/ene_ub6250.c                          | 1 +
 drivers/usb/storage/uas.c                                 | 1 +
 drivers/video/fbdev/geode/lxfb_ops.c                      | 1 +
 drivers/video/fbdev/pm2fb.c                               | 1 +
 drivers/watchdog/machzwd.c                                | 1 +
 drivers/xen/manage.c                                      | 1 +
 fs/afs/cmservice.c                                        | 5 +++++
 fs/afs/fsclient.c                                         | 4 ++++
 fs/afs/vlclient.c                                         | 1 +
 fs/ceph/dir.c                                             | 2 ++
 fs/cifs/inode.c                                           | 1 +
 fs/cifs/sess.c                                            | 1 +
 fs/cifs/smbdirect.c                                       | 1 +
 fs/ext2/inode.c                                           | 1 +
 fs/ext4/super.c                                           | 1 +
 fs/gfs2/inode.c                                           | 2 ++
 fs/gfs2/recovery.c                                        | 1 +
 fs/isofs/rock.c                                           | 1 +
 fs/nfs/nfs3acl.c                                          | 1 +
 fs/nfs/nfs4client.c                                       | 1 +
 fs/nfs/nfs4proc.c                                         | 2 ++
 fs/nfs/nfs4state.c                                        | 1 +
 fs/nfs/pnfs.c                                             | 2 ++
 fs/nfsd/nfs4state.c                                       | 1 +
 fs/nfsd/nfsctl.c                                          | 1 +
 fs/reiserfs/namei.c                                       | 1 +
 mm/mm_init.c                                              | 1 +
 mm/vmscan.c                                               | 1 +
 net/ax25/af_ax25.c                                        | 1 +
 net/bridge/br_input.c                                     | 1 +
 net/core/dev.c                                            | 1 +
 net/decnet/dn_route.c                                     | 2 +-
 net/ipv4/ah4.c                                            | 1 +
 net/ipv4/esp4.c                                           | 1 +
 net/ipv4/fib_semantics.c                                  | 1 +
 net/ipv4/ip_vti.c                                         | 1 +
 net/ipv4/ipcomp.c                                         | 1 +
 net/ipv4/netfilter/ipt_REJECT.c                           | 1 +
 net/mac80211/cfg.c                                        | 2 ++
 net/netfilter/nf_conntrack_proto_dccp.c                   | 1 +
 net/netfilter/nf_tables_api.c                             | 1 +
 net/netfilter/nft_ct.c                                    | 1 +
 net/netrom/nr_route.c                                     | 4 ++++
 net/packet/af_packet.c                                    | 1 +
 net/rds/tcp_connect.c                                     | 1 +
 net/rds/threads.c                                         | 2 ++
 net/rose/rose_route.c                                     | 2 ++
 net/rxrpc/af_rxrpc.c                                      | 1 +
 net/sctp/input.c                                          | 3 ++-
 net/sunrpc/rpc_pipe.c                                     | 1 +
 net/sunrpc/xprtsock.c                                     | 1 +
 net/tipc/link.c                                           | 1 +
 net/wireless/nl80211.c                                    | 1 +
 net/wireless/util.c                                       | 1 +
 net/xfrm/xfrm_interface.c                                 | 1 +
 security/integrity/ima/ima_main.c                         | 1 +
 security/integrity/ima/ima_policy.c                       | 2 ++
 security/keys/process_keys.c                              | 1 +
 security/selinux/hooks.c                                  | 1 +
 sound/drivers/pcsp/pcsp_input.c                           | 1 +
 sound/isa/sb/sb8_main.c                                   | 1 +
 sound/pci/rme9652/hdspm.c                                 | 1 +
 sound/soc/codecs/adav80x.c                                | 1 +
 sound/soc/codecs/arizona.c                                | 1 +
 sound/soc/codecs/cs42l52.c                                | 1 +
 sound/soc/codecs/cs42l56.c                                | 1 +
 sound/soc/codecs/cs47l92.c                                | 1 +
 sound/soc/codecs/wm8962.c                                 | 1 +
 209 files changed, 264 insertions(+), 26 deletions(-)

-- 
2.27.0

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 023/141] staging: rtl8723bs: core: Fix fall-through warnings for Clang
  2020-11-20 18:21 [PATCH 000/141] Fix fall-through warnings for Clang Gustavo A. R. Silva
@ 2020-11-20 18:27 ` Gustavo A. R. Silva
  2020-11-20 18:27 ` [PATCH 024/141] staging: vt6655: " Gustavo A. R. Silva
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 47+ messages in thread
From: Gustavo A. R. Silva @ 2020-11-20 18:27 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, Gustavo A. R. Silva, linux-kernel, linux-hardening

In preparation to enable -Wimplicit-fallthrough for Clang, fix multiple
warnings by explicitly adding multiple break statements instead of just
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/staging/rtl8723bs/core/rtw_cmd.c       | 1 +
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c  | 1 +
 drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 1 +
 3 files changed, 3 insertions(+)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 2abe205e3453..232661e6a5c9 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1487,6 +1487,7 @@ void lps_ctrl_wk_hdl(struct adapter *padapter, u8 lps_ctrl_type)
 		break;
 	case LPS_CTRL_TRAFFIC_BUSY:
 		LPS_Leave(padapter, "LPS_CTRL_TRAFFIC_BUSY");
+		break;
 	default:
 		break;
 	}
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index b912ad2f4b72..ea44d653a591 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -1708,6 +1708,7 @@ unsigned int OnAssocRsp(struct adapter *padapter, union recv_frame *precv_frame)
 
 		case _ERPINFO_IE_:
 			ERP_IE_handler(padapter, pIE);
+			break;
 
 		default:
 			break;
diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index 372ce17c3569..2b13c683ba5c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -1505,6 +1505,7 @@ unsigned int is_ap_in_tkip(struct adapter *padapter)
 			case _RSN_IE_2_:
 				if (!memcmp((pIE->data + 8), RSN_TKIP_CIPHER, 4))
 					return true;
+				break;
 
 			default:
 				break;
-- 
2.27.0

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 024/141] staging: vt6655: Fix fall-through warnings for Clang
  2020-11-20 18:21 [PATCH 000/141] Fix fall-through warnings for Clang Gustavo A. R. Silva
  2020-11-20 18:27 ` [PATCH 023/141] staging: rtl8723bs: core: " Gustavo A. R. Silva
@ 2020-11-20 18:27 ` Gustavo A. R. Silva
  2020-11-20 18:28 ` [PATCH 000/141] " Joe Perches
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 47+ messages in thread
From: Gustavo A. R. Silva @ 2020-11-20 18:27 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman
  Cc: devel, Gustavo A. R. Silva, linux-kernel, linux-hardening

In preparation to enable -Wimplicit-fallthrough for Clang, fix multiple
warnings by explicitly adding multiple break statements instead of just
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/staging/vt6655/device_main.c | 1 +
 drivers/staging/vt6655/rxtx.c        | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index 09ab6d6f2429..0adbd2b67df0 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -1579,6 +1579,7 @@ static int vnt_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 	case DISABLE_KEY:
 		if (test_bit(key->hw_key_idx, &priv->key_entry_inuse))
 			clear_bit(key->hw_key_idx, &priv->key_entry_inuse);
+		break;
 	default:
 		break;
 	}
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 477d19314634..1a64152de189 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -1004,6 +1004,7 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,
 		switch (info->control.hw_key->cipher) {
 		case WLAN_CIPHER_SUITE_CCMP:
 			cbMICHDR = sizeof(struct vnt_mic_hdr);
+			break;
 		default:
 			break;
 		}
@@ -1318,6 +1319,7 @@ int vnt_generate_fifo_header(struct vnt_private *priv, u32 dma_idx,
 			break;
 		case WLAN_CIPHER_SUITE_CCMP:
 			tx_buffer_head->frag_ctl |= cpu_to_le16(FRAGCTL_AES);
+			break;
 		default:
 			break;
 		}
-- 
2.27.0

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-20 18:21 [PATCH 000/141] Fix fall-through warnings for Clang Gustavo A. R. Silva
  2020-11-20 18:27 ` [PATCH 023/141] staging: rtl8723bs: core: " Gustavo A. R. Silva
  2020-11-20 18:27 ` [PATCH 024/141] staging: vt6655: " Gustavo A. R. Silva
@ 2020-11-20 18:28 ` Joe Perches
  2020-11-20 19:02   ` Gustavo A. R. Silva
  2020-11-20 18:36 ` [PATCH 094/141] media: atomisp: " Gustavo A. R. Silva
                   ` (8 subsequent siblings)
  11 siblings, 1 reply; 47+ 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?


_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 094/141] media: atomisp: Fix fall-through warnings for Clang
  2020-11-20 18:21 [PATCH 000/141] Fix fall-through warnings for Clang Gustavo A. R. Silva
                   ` (2 preceding siblings ...)
  2020-11-20 18:28 ` [PATCH 000/141] " Joe Perches
@ 2020-11-20 18:36 ` Gustavo A. R. Silva
  2020-11-22 16:32   ` Mauro Carvalho Chehab
  2020-11-20 18:39 ` [PATCH 127/141] staging: qlge: " Gustavo A. R. Silva
                   ` (7 subsequent siblings)
  11 siblings, 1 reply; 47+ messages in thread
From: Gustavo A. R. Silva @ 2020-11-20 18:36 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Sakari Ailus, Greg Kroah-Hartman
  Cc: devel, Gustavo A. R. Silva, linux-hardening, linux-kernel, linux-media

In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
by explicitly adding a break 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/staging/media/atomisp/pci/runtime/isys/src/rx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c b/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c
index b4813cd50daa..4a18da6bf0c1 100644
--- a/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c
+++ b/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c
@@ -368,6 +368,7 @@ static mipi_predictor_t sh_css_csi2_compression_type_2_mipi_predictor(
 		break;
 	case IA_CSS_CSI2_COMPRESSION_TYPE_2:
 		predictor = MIPI_PREDICTOR_TYPE2 - 1;
+		break;
 	default:
 		break;
 	}
-- 
2.27.0

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 127/141] staging: qlge: Fix fall-through warnings for Clang
  2020-11-20 18:21 [PATCH 000/141] Fix fall-through warnings for Clang Gustavo A. R. Silva
                   ` (3 preceding siblings ...)
  2020-11-20 18:36 ` [PATCH 094/141] media: atomisp: " Gustavo A. R. Silva
@ 2020-11-20 18:39 ` Gustavo A. R. Silva
  2020-11-25  4:42   ` Benjamin Poirier
  2020-11-20 18:39 ` [PATCH 128/141] staging: vt6656: " Gustavo A. R. Silva
                   ` (6 subsequent siblings)
  11 siblings, 1 reply; 47+ messages in thread
From: Gustavo A. R. Silva @ 2020-11-20 18:39 UTC (permalink / raw)
  To: Manish Chopra, Greg Kroah-Hartman
  Cc: devel, GR-Linux-NIC-Dev, netdev, Gustavo A. R. Silva,
	linux-kernel, linux-hardening

In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
by explicitly adding a break 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/staging/qlge/qlge_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
index 27da386f9d87..c41b1373dcf8 100644
--- a/drivers/staging/qlge/qlge_main.c
+++ b/drivers/staging/qlge/qlge_main.c
@@ -1385,6 +1385,7 @@ static void ql_categorize_rx_err(struct ql_adapter *qdev, u8 rx_err,
 		break;
 	case IB_MAC_IOCB_RSP_ERR_CRC:
 		stats->rx_crc_err++;
+		break;
 	default:
 		break;
 	}
-- 
2.27.0

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 128/141] staging: vt6656: Fix fall-through warnings for Clang
  2020-11-20 18:21 [PATCH 000/141] Fix fall-through warnings for Clang Gustavo A. R. Silva
                   ` (4 preceding siblings ...)
  2020-11-20 18:39 ` [PATCH 127/141] staging: qlge: " Gustavo A. R. Silva
@ 2020-11-20 18:39 ` Gustavo A. R. Silva
  2020-11-20 18:53 ` [PATCH 000/141] " Jakub Kicinski
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 47+ messages in thread
From: Gustavo A. R. Silva @ 2020-11-20 18:39 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman
  Cc: devel, Gustavo A. R. Silva, linux-kernel, linux-hardening

In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
by explicitly adding a break 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/staging/vt6656/main_usb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index 8bf851c53f4e..b90d3dab28b1 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -914,6 +914,7 @@ static int vnt_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 
 			vnt_mac_disable_keyentry(priv, key->hw_key_idx);
 		}
+		break;
 
 	default:
 		break;
-- 
2.27.0

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-20 18:21 [PATCH 000/141] Fix fall-through warnings for Clang Gustavo A. R. Silva
                   ` (5 preceding siblings ...)
  2020-11-20 18:39 ` [PATCH 128/141] staging: vt6656: " Gustavo A. R. Silva
@ 2020-11-20 18:53 ` Jakub Kicinski
  2020-11-20 19:04   ` Gustavo A. R. Silva
  2020-11-20 19:30   ` Kees Cook
  2020-11-20 22:21 ` Miguel Ojeda
                   ` (4 subsequent siblings)
  11 siblings, 2 replies; 47+ messages in thread
From: Jakub Kicinski @ 2020-11-20 18:53 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, 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

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?!
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-20 18:28 ` [PATCH 000/141] " Joe Perches
@ 2020-11-20 19:02   ` Gustavo A. R. Silva
  0 siblings, 0 replies; 47+ 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
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-20 18:53 ` [PATCH 000/141] " Jakub Kicinski
@ 2020-11-20 19:04   ` Gustavo A. R. Silva
  2020-11-20 19:30   ` Kees Cook
  1 sibling, 0 replies; 47+ 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
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-20 18:53 ` [PATCH 000/141] " Jakub Kicinski
  2020-11-20 19:04   ` Gustavo A. R. Silva
@ 2020-11-20 19:30   ` Kees Cook
  2020-11-20 19:51     ` Jakub Kicinski
  1 sibling, 1 reply; 47+ 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
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-20 19:30   ` Kees Cook
@ 2020-11-20 19:51     ` Jakub Kicinski
  2020-11-20 20:48       ` Kees Cook
  2020-11-22 16:17       ` Kees Cook
  0 siblings, 2 replies; 47+ messages in thread
From: Jakub Kicinski @ 2020-11-20 19:51 UTC (permalink / raw)
  To: Kees Cook
  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, 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 think clang is just being annoying here, but if I'm the only one who
feels this way chances are I'm wrong :)
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-20 19:51     ` Jakub Kicinski
@ 2020-11-20 20:48       ` Kees Cook
  2020-11-22 16:17       ` Kees Cook
  1 sibling, 0 replies; 47+ 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
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-20 18:21 [PATCH 000/141] Fix fall-through warnings for Clang Gustavo A. R. Silva
                   ` (6 preceding siblings ...)
  2020-11-20 18:53 ` [PATCH 000/141] " Jakub Kicinski
@ 2020-11-20 22:21 ` Miguel Ojeda
  2020-11-23 20:03 ` Jason Gunthorpe
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 47+ 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
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-20 19:51     ` Jakub Kicinski
  2020-11-20 20:48       ` Kees Cook
@ 2020-11-22 16:17       ` Kees Cook
  2020-11-22 18:21         ` James Bottomley
                           ` (2 more replies)
  1 sibling, 3 replies; 47+ 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
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 094/141] media: atomisp: Fix fall-through warnings for Clang
  2020-11-20 18:36 ` [PATCH 094/141] media: atomisp: " Gustavo A. R. Silva
@ 2020-11-22 16:32   ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 47+ messages in thread
From: Mauro Carvalho Chehab @ 2020-11-22 16:32 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: devel, Greg Kroah-Hartman, linux-kernel, linux-hardening,
	Sakari Ailus, linux-media

Em Fri, 20 Nov 2020 12:36:50 -0600
"Gustavo A. R. Silva" <gustavoars@kernel.org> escreveu:

> In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
> by explicitly adding a break 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>

Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

> ---
>  drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c b/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c
> index b4813cd50daa..4a18da6bf0c1 100644
> --- a/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c
> +++ b/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c
> @@ -368,6 +368,7 @@ static mipi_predictor_t sh_css_csi2_compression_type_2_mipi_predictor(
>  		break;
>  	case IA_CSS_CSI2_COMPRESSION_TYPE_2:
>  		predictor = MIPI_PREDICTOR_TYPE2 - 1;
> +		break;
>  	default:
>  		break;
>  	}



Thanks,
Mauro
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-22 16:17       ` Kees Cook
@ 2020-11-22 18:21         ` James Bottomley
  2020-11-22 18:25           ` Joe Perches
                             ` (2 more replies)
  2020-11-24  1:32         ` Nick Desaulniers
  2020-12-01 14:04         ` Dan Carpenter
  2 siblings, 3 replies; 47+ messages in thread
From: James Bottomley @ 2020-11-22 18:21 UTC (permalink / raw)
  To: 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, Joe Perches,
	linux-integrity, target-devel, linux-hardening

On Sun, 2020-11-22 at 08:17 -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/


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.

James


_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-22 18:21         ` James Bottomley
@ 2020-11-22 18:25           ` Joe Perches
  2020-11-22 19:12             ` James Bottomley
  2020-11-22 20:35           ` Miguel Ojeda
  2020-11-22 22:10           ` Sam Ravnborg
  2 siblings, 1 reply; 47+ 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.



_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-22 18:25           ` Joe Perches
@ 2020-11-22 19:12             ` James Bottomley
  2020-11-22 19:22               ` Joe Perches
  0 siblings, 1 reply; 47+ messages in thread
From: James Bottomley @ 2020-11-22 19:12 UTC (permalink / raw)
  To: Joe Perches, 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: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 ...

James


_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-22 19:12             ` James Bottomley
@ 2020-11-22 19:22               ` Joe Perches
  2020-11-22 19:53                 ` James Bottomley
  0 siblings, 1 reply; 47+ 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/


_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-22 19:22               ` Joe Perches
@ 2020-11-22 19:53                 ` James Bottomley
       [not found]                   ` <20201123130348.GA3119@embeddedor>
  0 siblings, 1 reply; 47+ messages in thread
From: James Bottomley @ 2020-11-22 19:53 UTC (permalink / raw)
  To: Joe Perches, 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:22 -0800, Joe Perches wrote:
> 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/

That's 21 reported fixes of which about 50% seem to produce no change
in code behaviour at all, a quarter seem to have no user visible effect
with the remaining quarter producing unexpected errors on obscure
configuration parameters, which is why no-one really noticed them
before.

James


_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-22 18:21         ` James Bottomley
  2020-11-22 18:25           ` Joe Perches
@ 2020-11-22 20:35           ` Miguel Ojeda
  2020-11-22 22:36             ` James Bottomley
  2020-11-22 22:10           ` Sam Ravnborg
  2 siblings, 1 reply; 47+ 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
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-22 18:21         ` James Bottomley
  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; 47+ 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
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-22 20:35           ` Miguel Ojeda
@ 2020-11-22 22:36             ` James Bottomley
  2020-11-23 14:19               ` Miguel Ojeda
  0 siblings, 1 reply; 47+ messages in thread
From: James Bottomley @ 2020-11-22 22:36 UTC (permalink / raw)
  To: 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, Joe Perches, linux-integrity,
	target-devel, linux-hardening

On Sun, 2020-11-22 at 21:35 +0100, Miguel Ojeda wrote:
> 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?

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).

>  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.

Well, the question I was asking is if it's worth the cost which I've
tried to outline above.

> I would agree if these changes were high risk, though; but they are
> almost trivial.

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.

James


_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-22 22:36             ` James Bottomley
@ 2020-11-23 14:19               ` Miguel Ojeda
  2020-11-23 15:58                 ` James Bottomley
  0 siblings, 1 reply; 47+ 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
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-23 14:19               ` Miguel Ojeda
@ 2020-11-23 15:58                 ` James Bottomley
  2020-11-23 16:32                   ` Joe Perches
  2020-11-23 18:56                   ` Miguel Ojeda
  0 siblings, 2 replies; 47+ messages in thread
From: James Bottomley @ 2020-11-23 15:58 UTC (permalink / raw)
  To: 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, Joe Perches, linux-integrity,
	target-devel, linux-hardening

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:
> > 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.

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.

> > 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.

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.

> 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.

James



_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-23 15:58                 ` James Bottomley
@ 2020-11-23 16:32                   ` Joe Perches
  2020-11-23 18:56                   ` Miguel Ojeda
  1 sibling, 0 replies; 47+ 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.


_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-23 15:58                 ` James Bottomley
  2020-11-23 16:32                   ` Joe Perches
@ 2020-11-23 18:56                   ` Miguel Ojeda
  2020-11-23 20:37                     ` James Bottomley
  1 sibling, 1 reply; 47+ 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
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-20 18:21 [PATCH 000/141] Fix fall-through warnings for Clang Gustavo A. R. Silva
                   ` (7 preceding siblings ...)
  2020-11-20 22:21 ` Miguel Ojeda
@ 2020-11-23 20:03 ` Jason Gunthorpe
  2020-11-24 14:47   ` Gustavo A. R. Silva
       [not found] ` <160616392671.21180.16517492185091399884.b4-ty@kernel.org>
                   ` (2 subsequent siblings)
  11 siblings, 1 reply; 47+ messages in thread
From: Jason Gunthorpe @ 2020-11-23 20:03 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, 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

On Fri, Nov 20, 2020 at 12:21:39PM -0600, Gustavo A. R. Silva wrote:

>   IB/hfi1: Fix fall-through warnings for Clang
>   IB/mlx4: Fix fall-through warnings for Clang
>   IB/qedr: Fix fall-through warnings for Clang
>   RDMA/mlx5: Fix fall-through warnings for Clang

I picked these four to the rdma tree, thanks

Jason
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-23 18:56                   ` Miguel Ojeda
@ 2020-11-23 20:37                     ` James Bottomley
  2020-11-25  0:32                       ` Miguel Ojeda
  0 siblings, 1 reply; 47+ messages in thread
From: James Bottomley @ 2020-11-23 20:37 UTC (permalink / raw)
  To: 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, Joe Perches, linux-integrity,
	target-devel, linux-hardening

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:
> > 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.

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 fact, this discussion probably took more time than the time it
> would take to review the 200 lines. :-)

I'm framing the discussion in terms of the whole series of changes we
have done for fall through, both what's in the tree currently (889
patches) both in terms of the produce and the consumer.  That's what I
used for my figures for cost.

> > 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

Part of what I'm trying to measure is the "and useful" bit because
that's not a given.

> is not what makes a voluntary maintainer quit...

so the proverb "straw which broke the camel's back" uniquely doesn't
apply to maintainers

>  Thankless work with demanding deadlines is.

That's another potential reason, but it doesn't may other reasons less
valid.

> > 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.

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.

> 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.

No, I evaluated the producer side in terms of an FTE.  What we're
mostly arguing about here is the consumer side: the maintainers and
people who have to rework their patch sets. I estimated that at 100h.

>  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.

You seem to be saying that because you find it easy to merge trivial
patches, everyone should.  I'm reminded of a friend long ago who
thought being a Tees River Pilot was a sinecure because he could
navigate the Tees blindfold.  What he forgot, of course, is that just
because it's easy with a trawler doesn't mean it's easy with an oil
tanker.  In fact it takes longer to qualify as a Tees River Pilot than
it does to get a PhD.

James


_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-22 16:17       ` Kees Cook
  2020-11-22 18:21         ` James Bottomley
@ 2020-11-24  1:32         ` Nick Desaulniers
  2020-11-24  1:46           ` Jakub Kicinski
                             ` (2 more replies)
  2020-12-01 14:04         ` Dan Carpenter
  2 siblings, 3 replies; 47+ messages in thread
From: Nick Desaulniers @ 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
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-24  1:32         ` Nick Desaulniers
@ 2020-11-24  1:46           ` Jakub Kicinski
  2020-11-24 21:25           ` Kees Cook
  2020-12-01 14:08           ` Dan Carpenter
  2 siblings, 0 replies; 47+ messages in thread
From: Jakub Kicinski @ 2020-11-24  1:46 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: alsa-devel, linux-atm-general, dri-devel, Gustavo A. R. Silva,
	dm-devel, keyrings, GR-everest-linux-l2, maintainer:X86,
	linux1394-devel, linux-afs, drbd-dev, devel, linux-cifs, bridge,
	amd-gfx list, ARCHITECTURE, cluster-devel, linux-acpi, coreteam,
	intel-wired-lan, 32-BIT AND 64-BIT, Kees Cook, linux-arm-msm,
	intel-gfx, linux-can, linux-block, ceph-devel, Linux ARM,
	GR-Linux-NIC-Dev, LKML,
	open list:HARDWARE RANDOM NUMBER GENERATOR CORE"
	<linux-crypto@vger.kernel.org>,
	linux-decnet-user@lists.sourceforge.net,
	linux-ext4@vger.kernel.org, linux-fbdev@vger.kernel.org,
	linux-geode@lists.infradead.org, linux-gpio@vger.kernel.org,
	linux-hams@vger.kernel.org, linux-hwmon@vger.kernel.org,
	linux-i3c@lists.infradead.org, linux-ide@vger.kernel.org,
	linux-iio@vger.kernel.org, linux-input@vger.kernel.org,
	linux-integrity@vger.kernel.org,
	linux-mediatek@lists.infradead.org, linux-media@vger.kernel.org,
	linux-mmc@vger.kernel.org,
	Linux Memory Management List  <linux-mm@kvack.org>,
	linux-mtd@lists.infradead.org, linux-nfs@vger.kernel.org,
	linux-rdma@vger.kernel.org,
	Linux-Renesas  <linux-renesas-soc@vger.kernel.org>,
	linux-scsi@vger.kernel.org, linux-sctp@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-usb@vger.kernel.org, linux-watchdog@vger.kernel.org,
	linux-wireless  <linux-wireless@vger.kernel. org>,
	Network Development  <netdev@vger.kernel.org>,
	netfilter-devel@vger.kernel.org, nouveau@lists.freedesktop.org,
	op-tee@lists.trustedfirmware.org, oss-drivers@netronome.com,
	patches@opensource.cirrus.com, rds-devel@oss.oracle.com,
	reiserfs-devel@vger.kernel.org, samba-technical@lists.samba.org,
	selinux@vger.kernel.org, target-devel@vger.kernel.org,
	tipc-discussion@lists.sourceforge.net,
	usb-storage@lists.one-eyed-alien.net,
	virtualization@lists.linux-foundation.org,
	wcn36xx@lists.infradead.org,

On Mon, 23 Nov 2020 17:32:51 -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

😍
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-23 20:03 ` Jason Gunthorpe
@ 2020-11-24 14:47   ` Gustavo A. R. Silva
  0 siblings, 0 replies; 47+ messages in thread
From: Gustavo A. R. Silva @ 2020-11-24 14:47 UTC (permalink / raw)
  To: Jason Gunthorpe
  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

On Mon, Nov 23, 2020 at 04:03:45PM -0400, Jason Gunthorpe wrote:
> On Fri, Nov 20, 2020 at 12:21:39PM -0600, Gustavo A. R. Silva wrote:
> 
> >   IB/hfi1: Fix fall-through warnings for Clang
> >   IB/mlx4: Fix fall-through warnings for Clang
> >   IB/qedr: Fix fall-through warnings for Clang
> >   RDMA/mlx5: Fix fall-through warnings for Clang
> 
> I picked these four to the rdma tree, thanks

Awesome. :)

Thank you, Jason.
--
Gustavo
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
       [not found] ` <160616392671.21180.16517492185091399884.b4-ty@kernel.org>
@ 2020-11-24 14:47   ` Gustavo A. R. Silva
  0 siblings, 0 replies; 47+ messages in thread
From: Gustavo A. R. Silva @ 2020-11-24 14:47 UTC (permalink / raw)
  To: Mark Brown
  Cc: alsa-devel, linux-atm-general, dm-devel, usb-storage,
	Nick Desaulniers, x86, dri-devel, virtualization, linux-mm,
	linux-sctp, target-devel, linux-mtd, linux-hardening, 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, tipc-discussion, linux-ext4, linux-media,
	Kees Cook, selinux, linux-arm-msm, intel-gfx, reiserfs-devel,
	linux-geode, linux-block, linux-gpio, op-tee, linux-mediatek,
	samba-technical, linux-fbdev, xen-devel, nouveau, linux-hams,
	Nathan Chancellor, linux-can, linux-arm-kernel, linux-hwmon,
	linux-watchdog, linux-nfs, GR-Linux-NIC-Dev, linux-ide,
	linux-decnet-user, patches, linux-usb, linux-wireless,
	linux-kernel, linux-iio, linux-renesas-soc,
	linux-security-module, keyrings, netfilter-devel, linux-crypto,
	netdev, Joe Perches, linux-integrity, GR-everest-linux-l2

On Mon, Nov 23, 2020 at 08:38:46PM +0000, Mark Brown 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.
> > 
> > [...]
> 
> 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

Thank you, Mark.
--
Gustavo
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-24  1:32         ` Nick Desaulniers
  2020-11-24  1:46           ` Jakub Kicinski
@ 2020-11-24 21:25           ` Kees Cook
  2020-11-25 23:02             ` Edward Cree
  2020-12-01 14:08           ` Dan Carpenter
  2 siblings, 1 reply; 47+ 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
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-23 20:37                     ` James Bottomley
@ 2020-11-25  0:32                       ` Miguel Ojeda
  0 siblings, 0 replies; 47+ 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
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 47+ messages in thread

* Re: [PATCH 127/141] staging: qlge: Fix fall-through warnings for Clang
  2020-11-20 18:39 ` [PATCH 127/141] staging: qlge: " Gustavo A. R. Silva
@ 2020-11-25  4:42   ` Benjamin Poirier
  2020-11-30 12:55     ` Dan Carpenter
  0 siblings, 1 reply; 47+ messages in thread
From: Benjamin Poirier @ 2020-11-25  4:42 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: devel, GR-Linux-NIC-Dev, Manish Chopra, Greg Kroah-Hartman,
	linux-kernel, linux-hardening, netdev

On 2020-11-20 12:39 -0600, Gustavo A. R. Silva wrote:
> In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
> by explicitly adding a break 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/staging/qlge/qlge_main.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
> index 27da386f9d87..c41b1373dcf8 100644
> --- a/drivers/staging/qlge/qlge_main.c
> +++ b/drivers/staging/qlge/qlge_main.c
> @@ -1385,6 +1385,7 @@ static void ql_categorize_rx_err(struct ql_adapter *qdev, u8 rx_err,
>  		break;
>  	case IB_MAC_IOCB_RSP_ERR_CRC:
>  		stats->rx_crc_err++;
> +		break;
>  	default:
>  		break;
>  	}

In this instance, it think it would be more appropriate to remove the
"default" case.
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang
       [not found]                           ` <CAKwvOdkGBn7nuWTAqrORMeN1G+w3YwBfCqqaRD2nwvoAXKi=Aw@mail.gmail.com>
@ 2020-11-25 16:24                             ` Jakub Kicinski
  2020-11-25 17:04                               ` Miguel Ojeda
  2020-11-25 22:09                               ` Nick Desaulniers
  0 siblings, 2 replies; 47+ messages in thread
From: Jakub Kicinski @ 2020-11-25 16:24 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: alsa-devel, bridge, linux-iio, linux-wireless,
	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 <gregkh@linuxfoundation.org>,
	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,
	Joe Perches, linux-nfs

On Wed, 25 Nov 2020 04:24:27 -0800 Nick Desaulniers wrote:
> I even agree that most of the churn comes from
> 
> case 0:
>   ++x;
> default:
>   break;

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. 

I really hope the Clang folks are reasonable and merge your patch.

> 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)?

The burn out point is about enjoying your work and feeling that it
matters. It really doesn't make much difference if you're doing
something you don't like for 12 hours every day or only in shifts with
another maintainer. You'll dislike it either way.

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.
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-25 16:24                             ` [Intel-wired-lan] " Jakub Kicinski
@ 2020-11-25 17:04                               ` Miguel Ojeda
  2020-11-25 22:09                               ` Nick Desaulniers
  1 sibling, 0 replies; 47+ 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
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-25 16:24                             ` [Intel-wired-lan] " Jakub Kicinski
  2020-11-25 17:04                               ` Miguel Ojeda
@ 2020-11-25 22:09                               ` Nick Desaulniers
  1 sibling, 0 replies; 47+ messages in thread
From: Nick Desaulniers @ 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
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-24 21:25           ` Kees Cook
@ 2020-11-25 23:02             ` Edward Cree
  0 siblings, 0 replies; 47+ messages in thread
From: Edward Cree @ 2020-11-25 23:02 UTC (permalink / raw)
  To: Kees Cook, 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 24/11/2020 21:25, Kees Cook wrote:
> I still think this isn't right -- it's a case statement that runs off
> the end without an explicit flow control determination.

Proves too much — for instance
    case foo:
    case bar:
        thing;
        break;
 doesn't require a fallthrough; after case foo:, and afaik
 no-one is suggesting it should.  Yet it, too, is "a case
 statement that runs off the end without an explicit flow
 control determination".

-ed
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 127/141] staging: qlge: Fix fall-through warnings for Clang
  2020-11-25  4:42   ` Benjamin Poirier
@ 2020-11-30 12:55     ` Dan Carpenter
  0 siblings, 0 replies; 47+ messages in thread
From: Dan Carpenter @ 2020-11-30 12:55 UTC (permalink / raw)
  To: Benjamin Poirier
  Cc: devel, GR-Linux-NIC-Dev, Manish Chopra, Greg Kroah-Hartman,
	Gustavo A. R. Silva, linux-kernel, linux-hardening, netdev

On Wed, Nov 25, 2020 at 01:42:57PM +0900, Benjamin Poirier wrote:
> On 2020-11-20 12:39 -0600, Gustavo A. R. Silva wrote:
> > In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
> > by explicitly adding a break 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/staging/qlge/qlge_main.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
> > index 27da386f9d87..c41b1373dcf8 100644
> > --- a/drivers/staging/qlge/qlge_main.c
> > +++ b/drivers/staging/qlge/qlge_main.c
> > @@ -1385,6 +1385,7 @@ static void ql_categorize_rx_err(struct ql_adapter *qdev, u8 rx_err,
> >  		break;
> >  	case IB_MAC_IOCB_RSP_ERR_CRC:
> >  		stats->rx_crc_err++;
> > +		break;
> >  	default:
> >  		break;
> >  	}
> 
> In this instance, it think it would be more appropriate to remove the
> "default" case.

There are checkers which complain about that.  (As a static checker
developer myself, I think complaining about missing default cases is a
waste of everyone's time).

regards,
dan carpenter
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-20 18:21 [PATCH 000/141] Fix fall-through warnings for Clang Gustavo A. R. Silva
                   ` (9 preceding siblings ...)
       [not found] ` <160616392671.21180.16517492185091399884.b4-ty@kernel.org>
@ 2020-12-01  5:52 ` Martin K. Petersen
  2020-12-01  8:20   ` Gustavo A. R. Silva
  2020-12-08  4:52 ` (subset) " Martin K. Petersen
  11 siblings, 1 reply; 47+ 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
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-12-01  5:52 ` Martin K. Petersen
@ 2020-12-01  8:20   ` Gustavo A. R. Silva
  0 siblings, 0 replies; 47+ messages in thread
From: Gustavo A. R. Silva @ 2020-12-01  8:20 UTC (permalink / raw)
  To: Martin K. Petersen
  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

On Tue, Dec 01, 2020 at 12:52:27AM -0500, Martin K. Petersen wrote:
> 
> 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.

Awesome! :)

Thanks, Martin.
--
Gustavo
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-22 16:17       ` Kees Cook
  2020-11-22 18:21         ` James Bottomley
  2020-11-24  1:32         ` Nick Desaulniers
@ 2020-12-01 14:04         ` Dan Carpenter
  2 siblings, 0 replies; 47+ 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
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-24  1:32         ` Nick Desaulniers
  2020-11-24  1:46           ` Jakub Kicinski
  2020-11-24 21:25           ` Kees Cook
@ 2020-12-01 14:08           ` Dan Carpenter
  2 siblings, 0 replies; 47+ 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
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: (subset) [PATCH 000/141] Fix fall-through warnings for Clang
  2020-11-20 18:21 [PATCH 000/141] Fix fall-through warnings for Clang Gustavo A. R. Silva
                   ` (10 preceding siblings ...)
  2020-12-01  5:52 ` Martin K. Petersen
@ 2020-12-08  4:52 ` Martin K. Petersen
  11 siblings, 0 replies; 47+ 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
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

end of thread, other threads:[~2020-12-08  4:52 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-20 18:21 [PATCH 000/141] Fix fall-through warnings for Clang Gustavo A. R. Silva
2020-11-20 18:27 ` [PATCH 023/141] staging: rtl8723bs: core: " Gustavo A. R. Silva
2020-11-20 18:27 ` [PATCH 024/141] staging: vt6655: " Gustavo A. R. Silva
2020-11-20 18:28 ` [PATCH 000/141] " Joe Perches
2020-11-20 19:02   ` Gustavo A. R. Silva
2020-11-20 18:36 ` [PATCH 094/141] media: atomisp: " Gustavo A. R. Silva
2020-11-22 16:32   ` Mauro Carvalho Chehab
2020-11-20 18:39 ` [PATCH 127/141] staging: qlge: " Gustavo A. R. Silva
2020-11-25  4:42   ` Benjamin Poirier
2020-11-30 12:55     ` Dan Carpenter
2020-11-20 18:39 ` [PATCH 128/141] staging: vt6656: " Gustavo A. R. Silva
2020-11-20 18:53 ` [PATCH 000/141] " Jakub Kicinski
2020-11-20 19:04   ` Gustavo A. R. Silva
2020-11-20 19:30   ` Kees Cook
2020-11-20 19:51     ` Jakub Kicinski
2020-11-20 20:48       ` Kees Cook
2020-11-22 16:17       ` Kees Cook
2020-11-22 18:21         ` James Bottomley
2020-11-22 18:25           ` Joe Perches
2020-11-22 19:12             ` James Bottomley
2020-11-22 19:22               ` Joe Perches
2020-11-22 19:53                 ` James Bottomley
     [not found]                   ` <20201123130348.GA3119@embeddedor>
     [not found]                     ` <8f5611bb015e044fa1c0a48147293923c2d904e4.camel@HansenPartnership.com>
     [not found]                       ` <202011241327.BB28F12F6@keescook>
     [not found]                         ` <a841536fe65bb33f1c72ce2455a6eb47a0107565.camel@HansenPartnership.com>
     [not found]                           ` <CAKwvOdkGBn7nuWTAqrORMeN1G+w3YwBfCqqaRD2nwvoAXKi=Aw@mail.gmail.com>
2020-11-25 16:24                             ` [Intel-wired-lan] " Jakub Kicinski
2020-11-25 17:04                               ` Miguel Ojeda
2020-11-25 22:09                               ` Nick Desaulniers
2020-11-22 20:35           ` Miguel Ojeda
2020-11-22 22:36             ` James Bottomley
2020-11-23 14:19               ` Miguel Ojeda
2020-11-23 15:58                 ` James Bottomley
2020-11-23 16:32                   ` Joe Perches
2020-11-23 18:56                   ` Miguel Ojeda
2020-11-23 20:37                     ` James Bottomley
2020-11-25  0:32                       ` Miguel Ojeda
2020-11-22 22:10           ` Sam Ravnborg
2020-11-24  1:32         ` Nick Desaulniers
2020-11-24  1:46           ` Jakub Kicinski
2020-11-24 21:25           ` Kees Cook
2020-11-25 23:02             ` Edward Cree
2020-12-01 14:08           ` Dan Carpenter
2020-12-01 14:04         ` Dan Carpenter
2020-11-20 22:21 ` Miguel Ojeda
2020-11-23 20:03 ` Jason Gunthorpe
2020-11-24 14:47   ` Gustavo A. R. Silva
     [not found] ` <160616392671.21180.16517492185091399884.b4-ty@kernel.org>
2020-11-24 14:47   ` Gustavo A. R. Silva
2020-12-01  5:52 ` Martin K. Petersen
2020-12-01  8:20   ` Gustavo A. R. Silva
2020-12-08  4:52 ` (subset) " Martin K. Petersen

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).