DPDK patches and discussions
 help / color / mirror / Atom feed
From: Amr Mokhtar <amr.mokhtar@intel.com>
To: dev@dpdk.org
Cc: Amr Mokhtar <amr.mokhtar@intel.com>
Subject: [dpdk-dev] [PATCH] app/testbbdev: fix division or modulo by float zero
Date: Wed, 31 Jan 2018 12:56:21 +0000	[thread overview]
Message-ID: <1517403381-129739-1-git-send-email-amr.mokhtar@intel.com> (raw)

check that iter > 0 before division

Coverity issue: 257027
Coverity issue: 257038
Coverity issue: 257014

Fixes: f714a18885a6 ("app/testbbdev: add test application for bbdev")

Signed-off-by: Amr Mokhtar <amr.mokhtar@intel.com>
---
 app/test-bbdev/test_bbdev_perf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
index f7b51ca..8f6896c 100644
--- a/app/test-bbdev/test_bbdev_perf.c
+++ b/app/test-bbdev/test_bbdev_perf.c
@@ -1805,7 +1805,7 @@ operation_latency_test(struct active_device *ad,
 				op_params->ref_enc_op, ad->dev_id, queue_id,
 				num_to_process, burst_sz, &total_time);
 
-	if (iter < 0)
+	if (iter <= 0)
 		return TEST_FAILED;
 
 	printf("\toperation avg. latency: %lg cycles, %lg us\n",
@@ -1955,7 +1955,7 @@ offload_latency_test(struct active_device *ad,
 				num_to_process, burst_sz, &enq_total_time,
 				&deq_total_time);
 
-	if (iter < 0)
+	if (iter <= 0)
 		return TEST_FAILED;
 
 	printf("\tenq offload avg. latency: %lg cycles, %lg us\n",
@@ -2047,7 +2047,7 @@ offload_latency_empty_q_test(struct active_device *ad,
 		iter = offload_latency_empty_q_test_enc(ad->dev_id, queue_id,
 				num_to_process, burst_sz, &deq_total_time);
 
-	if (iter < 0)
+	if (iter <= 0)
 		return TEST_FAILED;
 
 	printf("\tempty deq offload avg. latency: %lg cycles, %lg us\n",
-- 
2.7.4

             reply	other threads:[~2018-01-31 12:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-31 12:56 Amr Mokhtar [this message]
2018-01-31 14:56 ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1517403381-129739-1-git-send-email-amr.mokhtar@intel.com \
    --to=amr.mokhtar@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).