To reduce the possibility of bugs due to missing memory freeing on error paths (or even the success path) in functions, we can switch memory use from dynamic heap memory to stack memory in functions where both allocation and free occur within the one function, and where the total memory size is not very large (~4K max).
To facilitate this, the first patch of the series defines a new macro to simplify the creation of stack objects which are of the format struct+extra buffer, where the extra buffer space is sized to hold N objects from a flex array member at the end of the primary structure. That macro is then used throughout the drivers to define most of the new stack variables used for e.g. admin queue messages. Bruce Richardson (6): eal: add macros for local variable-length structure buffers net/iavf: use stack storage for virtchnl messages net/ice: use stack storage for function-local buffers net/idpf: use stack storage for virtchnl messages net/cpfl: use stack storage for function-local buffers net/i40e: use stack storage for function-local buffers app/test/test_common.c | 54 ++++ drivers/net/intel/cpfl/cpfl_fxp_rule.c | 20 +- drivers/net/intel/cpfl/cpfl_representor.c | 15 +- drivers/net/intel/cpfl/cpfl_vchnl.c | 41 ++- drivers/net/intel/i40e/i40e_ethdev.c | 27 +- drivers/net/intel/i40e/i40e_testpmd.c | 10 +- drivers/net/intel/iavf/iavf_ipsec_crypto.c | 270 +++++------------- drivers/net/intel/iavf/iavf_tm.c | 26 +- drivers/net/intel/ice/ice_dcf.c | 21 +- drivers/net/intel/ice/ice_dcf_parent.c | 12 +- drivers/net/intel/ice/ice_dcf_sched.c | 25 +- drivers/net/intel/ice/ice_diagnose.c | 12 +- drivers/net/intel/ice/ice_ethdev.c | 104 ++----- drivers/net/intel/ice/ice_rxtx.c | 26 +- drivers/net/intel/ice/ice_tm.c | 7 +- drivers/net/intel/idpf/idpf_common_device.c | 27 +- drivers/net/intel/idpf/idpf_common_virtchnl.c | 77 ++--- lib/eal/include/rte_common.h | 46 +++ 18 files changed, 306 insertions(+), 514 deletions(-) -- 2.55.0

