[PATCH] table: fix overflow in rte_swx_table_selector_create

Bulatov Mark ms.bulatov7 at gmail.com
Fri Nov 13 15:25:59 CET 2026


table_create_check() checks the bounds of params->n_groups_max and
group_size individually. However, this does not guarantee that their
product will not cause an overflow.

Fix this by using type casting.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: f7598a62d1 ("table: support selector table")
Cc: stable at dpdk.org

Signed-off-by: Alexey Simakov <bigalex934 at gmail.com>
Signed-off-by: Mark Bulatov <ms.bulatov7 at gmail.com>
---
 lib/table/rte_swx_table_selector.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/table/rte_swx_table_selector.c b/lib/table/rte_swx_table_selector.c
index d42f67f157..d976904b7d 100644
--- a/lib/table/rte_swx_table_selector.c
+++ b/lib/table/rte_swx_table_selector.c
@@ -289,7 +289,7 @@ rte_swx_table_selector_create(struct rte_swx_table_selector_params *params,
 
 	/* Group. */
 	group_size = params->n_members_per_group_max * sizeof(uint32_t);
-	t->group_table_size = params->n_groups_max * group_size;
+	t->group_table_size = (uint64_t)params->n_groups_max * group_size;
 
 	t->group_table = env_calloc(t->group_table_size, RTE_CACHE_LINE_SIZE, numa_node);
 	if (!t->group_table)
-- 
2.39.5



More information about the dev mailing list