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 2150DA034C; Sun, 18 Dec 2022 11:08:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CCF3A42D2D; Sun, 18 Dec 2022 11:07:41 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 86D0140685 for ; Fri, 16 Dec 2022 08:42:01 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BG2es2S029278; Thu, 15 Dec 2022 23:42:00 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=+bbOlrERQThOHR6C/LYpWo0q9azFWKMLZ5y5gZ4tdpo=; b=ZUOa9CsesfJ8vv7sF7+hLbrSk/C/Jkc9lgvMjZC/o9NUTUHo3XJLUm5tYM3UN9jV5DyY 4qzMs6MtxutP+NSV3tyJ8dBAEcbx8lazQowgOFbi6gQNNLLB9kBmHheTSNJXpLdhCuqa N5lSyRUzwQufoeJWR22RLRPFprBAoOwt4wb8BmLW42krYUkver/ueJUUCC/0rniD/1bD E8Buyrg8nppHgJJcG8yPI5oFjgpMTzsqq+IIqRigv+bFbbOJDmlFF/UODFv6CcEYTP0v Cnb7kC3e+4yJ1CiXhFk9R+PtUYjx/X0Qs6O1dEtB8l3JtYCxUgVjoeZGHJzYvtXdb0tr KA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3mgg3ns2r4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 15 Dec 2022 23:42:00 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 15 Dec 2022 23:41:59 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.42 via Frontend Transport; Thu, 15 Dec 2022 23:41:58 -0800 Received: from localhost.localdomain (unknown [10.28.34.23]) by maili.marvell.com (Postfix) with ESMTP id CF09E3F7069; Thu, 15 Dec 2022 23:41:54 -0800 (PST) From: Mohammad Iqbal Ahmad To: , Wisam Jaddo , Xiaoyu Min CC: , , , , , , , , , , , Mohammad Iqbal Ahmad Subject: [PATCH v1 2/2] app/test-flow-perf: fix division or module by zero Date: Fri, 16 Dec 2022 13:09:58 +0530 Message-ID: <20221216073958.1645736-2-mahmad@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221216073958.1645736-1-mahmad@marvell.com> References: <20221216073958.1645736-1-mahmad@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: gEDAmJNKrfkmIGZRNMCTmFLsWsojQIS2 X-Proofpoint-ORIG-GUID: gEDAmJNKrfkmIGZRNMCTmFLsWsojQIS2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-16_04,2022-12-15_02,2022-06-22_01 X-Mailman-Approved-At: Sun, 18 Dec 2022 11:07:34 +0100 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 Fix division or module by zero reported by coverity scan. Coverity issue: 373870 Fixes: bf3688f1e816 ("app/flow-perf: add insertion rate calculation") Signed-off-by: Mohammad Iqbal Ahmad --- app/test-flow-perf/main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index 4a9206803a..0a542b0d87 100644 --- a/app/test-flow-perf/main.c +++ b/app/test-flow-perf/main.c @@ -848,7 +848,12 @@ args_parse(int argc, char **argv) /* Control */ if (strcmp(lgopts[opt_idx].name, "rules-batch") == 0) { - rules_batch = atoi(optarg); + n = atoi(optarg); + if (n > 0) + rules_batch = n; + else + rte_exit(EXIT_FAILURE, + "flow rules_batch should be > 0\n"); } if (strcmp(lgopts[opt_idx].name, "rules-count") == 0) { -- 2.25.1