[PATCH 0/6] Fix LTO compilation warnings

Stephen Hemminger
2026-01-20T19:54:34Z

TLDR; fixes LTO build

Full explaination from AI...
This patch series addresses multiple compilation warnings and one buffer
overflow bug that are revealed when with Link Time Optimization (LTO)
enabled.

LTO enables cross-compilation-unit analysis and inlining, which allows
GCC to detect issues that would otherwise be hidden. The patches fall
into three categories:

1. Variable Length Array (VLA) fixes in common/cnxk [patches 1-3]
- Replace VLAs with fixed-size arrays and appropriate bounds checking
- Re-enable VLA warnings after fixes are complete

2. Actual bug fix in common/cnxk [patch 4]
- Fixes buffer overflow in IPsec inbound SA initialization
- Detected by GCC's -Wstringop-overflow with LTO enabled

3. False positive warning fixes [patches 5-6]
- Add explicit bounds checks to help GCC's static analysis
- Adjust inline attributes to prevent spurious warnings

All patches have been tested with LTO enabled and resolve the respective
compilation warnings.

Stephen Hemminger (6):
common/cnxk: replace variable length state array
common/cnxk: replace variable length array
common/cnxk: re-enable vla warnings
common/cnxk: fix buffer overflow in SA setup
net/mlx5: fix LTO stringop-overflow warning
ring: use inline instead of always inline in soring

drivers/common/cnxk/meson.build | 1 -
drivers/common/cnxk/roc_aes.c | 3 ++-
drivers/common/cnxk/roc_nix_inl.c | 2 +-
drivers/common/cnxk/roc_platform.c | 4 ++--
drivers/net/mlx5/hws/mlx5dr_action.c | 14 ++++++++++++++
lib/ring/soring.c | 4 ++--
6 files changed, 21 insertions(+), 7 deletions(-)

--
2.51.0