Check that nb_jobs is not zero before using it for a division.

Fixes: f5cffb7eb7fb6 ("app/regex: read data file once at startup")
Cc: sta...@dpdk.org
Cc: Ori Kam <or...@nvidia.com>

Signed-off-by: Thierry Herbelot <thierry.herbe...@6wind.com>
---
 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 8e665df73ce0..8f48cab11924 100644
--- a/app/test-regex/main.c
+++ b/app/test-regex/main.c
@@ -714,6 +714,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.29.2

Reply via email to