Thread (5 messages) 5 messages, 3 authors, 2017-07-31
STALE3282d

[PATCH 2/2] app/testeventdev: fix a divide by zero case

From: Jerin Jacob <hidden>
Date: 2017-07-31 10:04:52
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help