DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH 00/37] enable unreachable code detection
Date: Sun, 29 Nov 2026 16:26:45 -0800	[thread overview]
Message-ID: <20261130002752.2342213-1-stephen@networkplumber.org> (raw)

Unreachable code is often a symptom of a real bug: a misplaced
return, an inverted condition, or a loop that can only run once.
DPDK does not build with -Wunreachable-code anywhere, so none of it
gets caught.

This series fixes everything clang reports with
-Wunreachable-code-aggressive and turns the check on for the whole
tree. Only clang implements it; GCC rejects the flag and documents
-Wunreachable-code as doing nothing.

It found four real bugs: only one event vector adapter per queue
was usable, a leftover debug abort() in the dpaa2 flow engine, the
dpaa2 traffic manager port state check stubbed out as "if (0)", and
eight dead error paths in the ipsec-secgw config parser.

The rest is dead statements and examples that could never run their
own cleanup, which now handle SIGINT and SIGTERM. Removing a
trailing return is not just tidying: a case that later forgets to
return becomes a compiler error rather than silently returning zero.

Eleven drivers keep an exemption for base code imported from
vendors, applied through base_cflags where the driver separates its
base sources so its own code is still checked.

Bugzilla ID: 2135
Bugzilla ID: 2139
Bugzilla ID: 2140

Tested on x86 with clang and gcc, both -Dwerror=true examples=all,
and on Arm64. Two of the defects were invisible in an x86 clang
build alone.

Removing common/ exports that no other driver uses is a related but
larger job, and will be sent separately.

Dariusz Sosnowski (2):
  net/mlx4: fix unreachable code warnings
  net/mlx5: fix unreachable code warnings

Stephen Hemminger (35):
  eventdev: fix vector adapter instance allocation
  eal: silence unreachable code in version string
  net/dpaa2: remove debug abort in flow destroy
  app/testpmd: fix unreachable VF traffic error message
  examples/eventdev_pipeline: remove dead continue
  examples/ipsec-secgw: remove unreachable config error path
  examples/skeleton: handle SIGINT and SIGTERM
  examples/rxtx_callbacks: handle SIGINT and SIGTERM
  examples/service_cores: handle SIGINT and SIGTERM
  examples/timer: handle SIGINT and SIGTERM
  examples/multi_process: handle SIGINT and SIGTERM in client
  examples/server_node_efd: handle SIGINT and SIGTERM in node
  examples/pipeline: handle SIGINT and SIGTERM
  ethdev: fix unreachable warnings from switch declarations
  config: add per-directory option for -Wunreachable-code
  bus/dpaa: exempt this driver from unreachable code detection
  net/qede: disable unreachable code checks
  net/txgbe: disable unreachable code checks
  net/ixgbe: disable unreachable code check
  net/ngbe: disable unreachable code check
  net/octeontx: replace unreachable code
  common/sfc_efx: disable unreachable code check for base code
  net/dpaa2: check port state before changing TM hierarchy
  net/e1000: disable unreachable code check for base code
  net/ice: disable unreachable code check for base code
  raw/ifpga: disable unreachable code check for base code
  net/bnxt: disable unreachable code check
  net/ntnic: disable unreachable code check
  lib: mark never returning thread functions
  lib: remove unreachable statements
  app: remove unreachable statements
  examples: remove unreachable statements
  drivers: remove unreachable statements
  efd: mark configuration dependent vector selection
  config: enable unreachable code detection

 app/dumpcap/main.c                            |  1 -
 app/pdump/main.c                              |  1 -
 .../comp_perf_options_parse.c                 |  1 -
 app/test-crypto-perf/cperf_ops.c              |  1 -
 app/test-crypto-perf/cperf_options_parsing.c  |  1 -
 app/test-flow-perf/main.c                     |  1 -
 app/test-gpudev/main.c                        |  1 -
 app/test-pmd/config.c                         |  4 +-
 app/test-pmd/parameters.c                     |  2 -
 app/test-regex/main.c                         |  2 -
 app/test-security-perf/test_security_perf.c   |  1 -
 app/test/test_cryptodev.c                     |  9 ---
 app/test/test_cryptodev_crosscheck.c          |  6 --
 app/test/test_eal_flags.c                     |  1 -
 app/test/test_event_vector_adapter.c          | 19 +++--
 config/meson.build                            |  9 +++
 drivers/bus/dpaa/meson.build                  |  3 +
 drivers/common/cnxk/roc_nix_fc.c              |  2 -
 drivers/common/mlx5/linux/mlx5_nl.c           |  1 -
 drivers/common/sfc_efx/base/meson.build       |  1 +
 drivers/crypto/caam_jr/caam_jr.c              |  1 -
 drivers/crypto/openssl/rte_openssl_pmd.c      |  1 -
 drivers/dma/dpaa/dpaa_qdma.c                  |  2 -
 drivers/event/dsw/dsw_xstats.c                |  1 -
 drivers/ml/cnxk/cnxk_ml_ops.c                 | 10 ---
 drivers/net/bnx2x/bnx2x.c                     |  2 -
 drivers/net/bnxt/meson.build                  |  3 +
 drivers/net/cnxk/cnxk_ethdev_mtr.c            |  3 -
 drivers/net/dpaa2/dpaa2_flow.c                |  1 -
 drivers/net/dpaa2/dpaa2_tm.c                  |  6 +-
 drivers/net/intel/e1000/meson.build           |  3 +
 drivers/net/intel/ice/meson.build             |  3 +
 drivers/net/intel/ipn3ke/ipn3ke_representor.c |  3 -
 drivers/net/intel/ipn3ke/ipn3ke_tm.c          |  1 -
 drivers/net/intel/ixgbe/meson.build           |  3 +
 drivers/net/mlx4/mlx4_flow.c                  | 14 ++--
 drivers/net/mlx5/linux/mlx5_mp_os.c           |  1 -
 drivers/net/mlx5/mlx5_flow_dv.c               |  1 -
 drivers/net/mlx5/mlx5_flow_flex.c             |  1 -
 drivers/net/mlx5/mlx5_flow_hw.c               | 18 +++--
 drivers/net/mlx5/mlx5_flow_verbs.c            | 16 ++---
 drivers/net/ngbe/base/meson.build             |  3 +
 drivers/net/ntnic/meson.build                 |  3 +
 drivers/net/octeontx/base/octeontx_pkovf.c    |  9 ++-
 drivers/net/qede/base/meson.build             |  3 +
 drivers/net/qede/meson.build                  |  2 +-
 drivers/net/sfc/sfc_mae.c                     |  2 -
 drivers/net/txgbe/base/meson.build            |  3 +
 drivers/net/txgbe/meson.build                 |  1 +
 drivers/raw/ifpga/base/meson.build            |  1 +
 drivers/vdpa/ifc/ifcvf_vdpa.c                 |  4 --
 drivers/vdpa/mlx5/mlx5_vdpa_cthread.c         |  1 -
 drivers/vdpa/mlx5/mlx5_vdpa_event.c           |  2 -
 drivers/vdpa/nfp/nfp_vdpa.c                   |  5 --
 examples/bond/main.c                          |  1 -
 examples/eventdev_pipeline/main.c             |  4 +-
 examples/ipsec-secgw/parser.c                 | 40 +++--------
 examples/l2fwd-jobstats/main.c                |  2 -
 examples/l3fwd/main.c                         |  4 --
 .../client_server_mp/mp_client/client.c       | 20 +++++-
 examples/ntb/ntb_fwd.c                        |  1 -
 examples/pipeline/main.c                      | 21 +++++-
 examples/pipeline/thread.c                    |  2 +-
 examples/pipeline/thread.h                    |  6 ++
 examples/rxtx_callbacks/main.c                | 19 ++++-
 examples/server_node_efd/efd_node/node.c      | 20 +++++-
 examples/service_cores/main.c                 | 23 +++++-
 examples/skeleton/basicfwd.c                  | 18 ++++-
 examples/timer/main.c                         | 23 +++++-
 examples/vhost/main.c                         |  4 +-
 lib/cmdline/cmdline_parse_num.c               |  2 -
 lib/eal/common/rte_version.c                  |  7 +-
 lib/efd/rte_efd.c                             | 10 +--
 lib/ethdev/rte_flow.c                         | 71 +++++++++----------
 lib/eventdev/rte_event_eth_rx_adapter.c       |  4 +-
 lib/eventdev/rte_event_vector_adapter.c       |  5 +-
 lib/fib/rte_fib.c                             |  1 -
 lib/fib/rte_fib6.c                            |  1 -
 lib/sched/rte_sched.c                         |  1 -
 lib/vhost/socket.c                            |  4 +-
 lib/vhost/vhost_crypto.c                      |  1 -
 81 files changed, 278 insertions(+), 237 deletions(-)

-- 
2.53.0


             reply	other threads:[~2026-11-30  0:28 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  0:26 Stephen Hemminger [this message]
2026-11-30  0:26 ` [PATCH 01/37] net/mlx4: fix unreachable code warnings Stephen Hemminger
2026-11-30  0:26 ` [PATCH 02/37] net/mlx5: " Stephen Hemminger
2026-11-30  0:26 ` [PATCH 03/37] eventdev: fix vector adapter instance allocation Stephen Hemminger
2026-11-30  0:26 ` [PATCH 04/37] eal: silence unreachable code in version string Stephen Hemminger
2026-11-30  9:13   ` Bruce Richardson
2026-11-30  0:26 ` [PATCH 05/37] net/dpaa2: remove debug abort in flow destroy Stephen Hemminger
2026-11-30  0:26 ` [PATCH 06/37] app/testpmd: fix unreachable VF traffic error message Stephen Hemminger
2026-11-30  0:26 ` [PATCH 07/37] examples/eventdev_pipeline: remove dead continue Stephen Hemminger
2026-11-30  0:26 ` [PATCH 08/37] examples/ipsec-secgw: remove unreachable config error path Stephen Hemminger
2026-11-30  9:52   ` Radu Nicolau
2026-11-30  0:26 ` [PATCH 09/37] examples/skeleton: handle SIGINT and SIGTERM Stephen Hemminger
2026-11-30  0:26 ` [PATCH 10/37] examples/rxtx_callbacks: " Stephen Hemminger
2026-11-30  0:26 ` [PATCH 11/37] examples/service_cores: " Stephen Hemminger
2026-11-30  0:26 ` [PATCH 12/37] examples/timer: " Stephen Hemminger
2026-11-30  0:26 ` [PATCH 13/37] examples/multi_process: handle SIGINT and SIGTERM in client Stephen Hemminger
2026-11-30  0:26 ` [PATCH 14/37] examples/server_node_efd: handle SIGINT and SIGTERM in node Stephen Hemminger
2026-11-30  0:27 ` [PATCH 15/37] examples/pipeline: handle SIGINT and SIGTERM Stephen Hemminger
2026-11-30  0:27 ` [PATCH 16/37] ethdev: fix unreachable warnings from switch declarations Stephen Hemminger
2026-11-30  0:27 ` [PATCH 17/37] config: add per-directory option for -Wunreachable-code Stephen Hemminger
2026-11-30  0:27 ` [PATCH 18/37] bus/dpaa: exempt this driver from unreachable code detection Stephen Hemminger
2026-11-30  0:27 ` [PATCH 19/37] net/qede: disable unreachable code checks Stephen Hemminger
2026-11-30  0:27 ` [PATCH 20/37] net/txgbe: " Stephen Hemminger
2026-11-30  0:27 ` [PATCH 21/37] net/ixgbe: disable unreachable code check Stephen Hemminger
2026-11-30  9:14   ` Bruce Richardson
2026-11-30  0:27 ` [PATCH 22/37] net/ngbe: " Stephen Hemminger
2026-11-30  0:27 ` [PATCH 23/37] net/octeontx: replace unreachable code Stephen Hemminger
2026-11-30  0:27 ` [PATCH 24/37] common/sfc_efx: disable unreachable code check for base code Stephen Hemminger
2026-11-30  0:27 ` [PATCH 25/37] net/dpaa2: check port state before changing TM hierarchy Stephen Hemminger
2026-11-30  0:27 ` [PATCH 26/37] net/e1000: disable unreachable code check for base code Stephen Hemminger
2026-11-30  9:14   ` Bruce Richardson
2026-11-30  0:27 ` [PATCH 27/37] net/ice: " Stephen Hemminger
2026-11-30  9:16   ` Bruce Richardson
2026-11-30  0:27 ` [PATCH 28/37] raw/ifpga: " Stephen Hemminger
2026-11-30  9:43   ` Bruce Richardson
2026-11-30  0:27 ` [PATCH 29/37] net/bnxt: disable unreachable code check Stephen Hemminger
2026-11-30  0:27 ` [PATCH 30/37] net/ntnic: " Stephen Hemminger
2026-11-30  0:27 ` [PATCH 31/37] lib: mark never returning thread functions Stephen Hemminger
2026-11-30  9:44   ` Bruce Richardson
2026-11-30  0:27 ` [PATCH 32/37] lib: remove unreachable statements Stephen Hemminger
2026-11-30  0:27 ` [PATCH 33/37] app: " Stephen Hemminger
2026-11-30  0:27 ` [PATCH 34/37] examples: " Stephen Hemminger
2026-11-30  9:45   ` Bruce Richardson
2026-11-30  0:27 ` [PATCH 35/37] drivers: " Stephen Hemminger
2026-11-30 10:59   ` Dariusz Sosnowski
2026-11-30  0:27 ` [PATCH 36/37] efd: mark configuration dependent vector selection Stephen Hemminger
2026-11-30  0:27 ` [PATCH 37/37] config: enable unreachable code detection Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261130002752.2342213-1-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox