RFC sample illustrating simple conversion of VLA to alloca() where
dimension multiplier removed.

Signed-off-by: Tyler Retzlaff <roret...@linux.microsoft.com>
---
 lib/hash/rte_thash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c
index 68f653f..633e211 100644
--- a/lib/hash/rte_thash.c
+++ b/lib/hash/rte_thash.c
@@ -771,7 +771,7 @@ struct rte_thash_subtuple_helper *
        uint32_t desired_value, unsigned int attempts,
        rte_thash_check_tuple_t fn, void *userdata)
 {
-       uint32_t tmp_tuple[tuple_len / sizeof(uint32_t)];
+       uint32_t *tmp_tuple = alloca(tuple_len);
        unsigned int i, j, ret = 0;
        uint32_t hash, adj_bits;
        const uint8_t *hash_key;
-- 
1.8.3.1

Reply via email to