[PATCH v2 0/3] common/cnxk: remove variable length arrays
Stephen Hemminger
stephen at networkplumber.org
Wed Jan 14 02:49:58 CET 2026
This series removes the use of variable length arrays (VLAs) from the
common/cnxk driver, allowing the VLA compiler warnings to be re-enabled.
VLAs are problematic for several reasons:
- They can cause stack overflow with large or malicious inputs
- They prevent certain compiler optimizations
- They trigger warnings when compiled with LTO (-Wvla-larger-than=)
- They are optional in C11 and removed in some C dialects
The first patch addresses the AES cipher function which always operates
on 16-byte blocks. The VLA is replaced with a fixed-size array using
the existing AES_HASH_KEY_LEN define, with an assertion to verify the
input constraint.
The second patch fixes the MSIX IRQ set buffer allocation. The original
code used a macro that expanded to a runtime function call, which the
compiler could not evaluate at compile time. This is replaced with
PLT_MAX_RXTX_INTR_VEC_ID, which matches the EAL's maximum interrupt
vector limit (512). This is consistent with how the EAL itself handles
the same buffer allocation in eal_interrupts.c.
The third patch removes the no_wvla_cflag workaround from meson.build
now that the VLAs have been eliminated.
Stephen Hemminger (3):
common/cnxk: replace variable length state array
common/cnxk: replace variable length array
common/cnxk: re-enable vla warnings
drivers/common/cnxk/meson.build | 2 --
drivers/common/cnxk/roc_aes.c | 3 ++-
drivers/common/cnxk/roc_platform.c | 4 ++--
3 files changed, 4 insertions(+), 5 deletions(-)
--
2.51.0
More information about the dev
mailing list