> From: Tyler Retzlaff [mailto:roret...@linux.microsoft.com] > Sent: Thursday, 4 April 2024 19.15 > > RFC sample illustrating simple conversion of VLA to alloca() where > dimension multiplier removed. > > Signed-off-by: Tyler Retzlaff <roret...@linux.microsoft.com> > ---
[...] > { > - uint32_t tmp_tuple[tuple_len / sizeof(uint32_t)]; > + uint32_t *tmp_tuple = alloca(tuple_len); This code is in the rte_thash_adjust_tuple() function [1]. I think we could use a constant size array here, making it large enough for what we think would suffice for any realistic purpose. The function could check the tuple_len parameter at runtime and return an error value if too big for the array. It could also check the tuple_len parameter, if constant, at build time. [1]: https://elixir.bootlin.com/dpdk/v24.03/source/lib/hash/rte_thash.c#L768