From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerin Jacob Subject: [PATCH 2/2] app/testeventdev: fix a divide by zero case Date: Mon, 31 Jul 2017 15:34:52 +0530 Message-ID: <20170731100452.12647-2-jerin.jacob@caviumnetworks.com> References: <20170731100452.12647-1-jerin.jacob@caviumnetworks.com> Mime-Version: 1.0 Content-Type: text/plain Cc: thomas@monjalon.net, bruce.richardson@intel.com, harry.van.haaren@intel.com, hemant.agrawal@nxp.com, gage.eads@intel.com, nipun.gupta@nxp.com, gprathyusha@caviumnetworks.com, Jerin Jacob , stable@dpdk.org To: dev@dpdk.org Return-path: In-Reply-To: <20170731100452.12647-1-jerin.jacob@caviumnetworks.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" pkts == 0 will result in divide by zero case. Added a check to fix it. Coverity issue: 158652 Fixes: 9d3aeb185eb4 ("app/testeventdev: launch perf lcores") Cc: stable@dpdk.org Signed-off-by: Jerin Jacob --- app/test-eventdev/test_perf_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c index a5b768c68..7b0929941 100644 --- a/app/test-eventdev/test_perf_common.c +++ b/app/test-eventdev/test_perf_common.c @@ -203,7 +203,7 @@ perf_launch_lcores(struct evt_test *test, struct evt_options *opt, perf_cycles = new_cycles; total_mpps += mpps; ++samples; - if (opt->fwd_latency) { + if (opt->fwd_latency && pkts > 0) { printf(CLGRN"\r%.3f mpps avg %.3f mpps [avg fwd latency %.3f us] "CLNRM, mpps, total_mpps/samples, (float)(latency/pkts)/freq_mhz); -- 2.13.3