app/regex: avoid division by zero
authorThierry Herbelot <thierry.herbelot@6wind.com>
Mon, 24 May 2021 08:57:00 +0000 (10:57 +0200)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 5 Jul 2022 20:03:39 +0000 (22:03 +0200)
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>
app/test-regex/main.c

index 7c014b2..fe90e11 100644 (file)
@@ -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,