DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerinjacobk@gmail.com>
To: Pavan Nikhilesh <pbhagavatula@marvell.com>
Cc: Jerin Jacob <jerinj@marvell.com>, dpdk-dev <dev@dpdk.org>,
	dpdk stable <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 1/2] app/test-eventdev: fix possible divide by zero
Date: Tue, 26 Nov 2019 14:01:00 +0900	[thread overview]
Message-ID: <CALBAE1NTAT_PAY3+iHonjG654179wT8Asosm77tHb2XMgLPN=Q@mail.gmail.com> (raw)
In-Reply-To: <20191121192240.12326-1-pbhagavatula@marvell.com>

On Fri, Nov 22, 2019 at 4:22 AM <pbhagavatula@marvell.com> wrote:
>
> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
>
> Fix possible divide by zero condition when calculating percentages.
>
> Coverity Issue: 277205
> Coverity Issue: 277234
> Fixes: d008f20bce23 ("app/eventdev: add event timer adapter as a producer")
> Cc: stable@dpdk.org
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>



Applied to dpdk-next-eventdev/master. Thanks.



> ---
>  app/test-eventdev/test_perf_common.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c
> index e7cf75a7d..b3af4bfec 100644
> --- a/app/test-eventdev/test_perf_common.c
> +++ b/app/test-eventdev/test_perf_common.c
> @@ -133,8 +133,9 @@ perf_event_timer_producer(void *arg)
>         fflush(stdout);
>         rte_delay_ms(1000);
>         printf("%s(): lcore %d Average event timer arm latency = %.3f us\n",
> -                       __func__, rte_lcore_id(), (float)(arm_latency / count) /
> -                       (rte_get_timer_hz() / 1000000));
> +                       __func__, rte_lcore_id(),
> +                       count ? (float)(arm_latency / count) /
> +                       (rte_get_timer_hz() / 1000000) : 0);
>         return 0;
>  }
>
> @@ -194,8 +195,9 @@ perf_event_timer_producer_burst(void *arg)
>         fflush(stdout);
>         rte_delay_ms(1000);
>         printf("%s(): lcore %d Average event timer arm latency = %.3f us\n",
> -                       __func__, rte_lcore_id(), (float)(arm_latency / count) /
> -                       (rte_get_timer_hz() / 1000000));
> +                       __func__, rte_lcore_id(),
> +                       count ? (float)(arm_latency / count) /
> +                       (rte_get_timer_hz() / 1000000) : 0);
>         return 0;
>  }
>
> --
> 2.17.1
>

      parent reply	other threads:[~2019-11-26  5:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-21 19:22 pbhagavatula
2019-11-21 19:22 ` [dpdk-dev] [PATCH 2/2] app/test-evnetdev: fix unchecked return value pbhagavatula
2019-11-26  5:18   ` Jerin Jacob
2019-11-26  5:01 ` Jerin Jacob [this message]

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='CALBAE1NTAT_PAY3+iHonjG654179wT8Asosm77tHb2XMgLPN=Q@mail.gmail.com' \
    --to=jerinjacobk@gmail.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=pbhagavatula@marvell.com \
    --cc=stable@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).