From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 004E3A0547; Mon, 24 May 2021 10:57:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ACE0F4003E; Mon, 24 May 2021 10:57:07 +0200 (CEST) Received: from proxy.6wind.com (host.78.145.23.62.rev.coltfrance.com [62.23.145.78]) by mails.dpdk.org (Postfix) with ESMTP id D9CD84003C; Mon, 24 May 2021 10:57:05 +0200 (CEST) Received: from localhost (unknown [10.16.0.39]) by proxy.6wind.com (Postfix) with ESMTP id C0EFC9B4797; Mon, 24 May 2021 10:57:05 +0200 (CEST) From: Thierry Herbelot To: dev@dpdk.org Cc: Thierry Herbelot , Thomas Monjalon , stable@dpdk.org, Ori Kam Date: Mon, 24 May 2021 10:57:00 +0200 Message-Id: <20210524085700.15534-1-thierry.herbelot@6wind.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] app/regex: avoid division by zero X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Cc: Ori Kam 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 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