[RFC PATCH v2 3/7] app/test-fib: fix size of the tables for large counts

Vladimir Medvedkin vladimir.medvedkin at intel.com
Wed Oct 14 20:39:17 CEST 2026


The sizes of the routes and lookup tables are computed in 32 bits, so
more than 268M IPv6 addresses for lookup overflow the size passed to
rte_malloc() and the tables are written past their end.

Widen the multiplications to size_t.

Fixes: 103809d032cd ("app/test-fib: add test application for FIB")
Cc: stable at dpdk.org

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin at intel.com>
---
 app/test-fib/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/test-fib/main.c b/app/test-fib/main.c
index d85d94fdd1..0bc8dd2aa4 100644
--- a/app/test-fib/main.c
+++ b/app/test-fib/main.c
@@ -1260,12 +1260,12 @@ main(int argc, char **argv)
 			BURST_SZ);
 
 	/* Alloc routes table*/
-	config.rt  = rte_malloc(NULL, rt_ent_sz * config.nb_routes, 0);
+	config.rt  = rte_malloc(NULL, (size_t)rt_ent_sz * config.nb_routes, 0);
 	if (config.rt == NULL)
 		rte_exit(-ENOMEM, "Can not alloc rt\n");
 
 	/* Alloc table with ip's for lookup*/
-	config.lookup_tbl  = rte_malloc(NULL, lookup_ent_sz *
+	config.lookup_tbl  = rte_malloc(NULL, (size_t)lookup_ent_sz *
 		config.nb_lookup_ips, 0);
 	if (config.lookup_tbl == NULL)
 		rte_exit(-ENOMEM, "Can not alloc lookup table\n");
-- 
2.43.0



More information about the dev mailing list