From 1afdf9edc8f7122cdaf8dae78e29fe8642c21484 Mon Sep 17 00:00:00 2001 From: Thierry Herbelot Date: Mon, 24 May 2021 10:57:00 +0200 Subject: [PATCH] app/regex: avoid division by zero Check that nb_jobs is not zero before using it for a division. Fixes: f5cffb7eb7fb6 ("app/regex: read data file once at startup") Cc: stable@dpdk.org Signed-off-by: Thierry Herbelot --- app/test-regex/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/test-regex/main.c b/app/test-regex/main.c index 7c014b2210..fe90e11313 100644 --- a/app/test-regex/main.c +++ b/app/test-regex/main.c @@ -728,6 +728,8 @@ main(int argc, char **argv) rte_exit(EXIT_FAILURE, "Number of QPs must be greater than 0\n"); if (nb_lcores == 0) rte_exit(EXIT_FAILURE, "Number of lcores must be greater than 0\n"); + if (nb_jobs == 0) + rte_exit(EXIT_FAILURE, "Number of jobs must be greater than 0\n"); if (distribute_qps_to_lcores(nb_lcores, nb_qps, &qps_per_lcore) < 0) rte_exit(EXIT_FAILURE, "Failed to distribute queues to lcores!\n"); ret = init_port(&nb_max_payload, rules_file, -- 2.39.5