From: Thierry Herbelot <thierry.herbelot@6wind.com> Date: Mon, 24 May 2021 08:57:00 +0000 (+0200) Subject: app/regex: avoid division by zero X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=1afdf9edc8f7122cdaf8dae78e29fe8642c21484;p=dpdk.git 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 <thierry.herbelot@6wind.com> --- 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,