patches for DPDK stable branches
 help / color / Atom feed
* [dpdk-stable] [dpdk-dev] [PATCH 1/2] app/test-eventdev: fix possible divide by zero
@ 2019-11-21 19:22 pbhagavatula
  2019-11-21 19:22 ` [dpdk-stable] [dpdk-dev] [PATCH 2/2] app/test-evnetdev: fix unchecked return value pbhagavatula
  2019-11-26  5:01 ` [dpdk-stable] [dpdk-dev] [PATCH 1/2] app/test-eventdev: fix possible divide by zero Jerin Jacob
  0 siblings, 2 replies; 4+ messages in thread
From: pbhagavatula @ 2019-11-21 19:22 UTC (permalink / raw)
  To: jerinj; +Cc: dev, Pavan Nikhilesh, stable

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>
---
 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-stable] [dpdk-dev] [PATCH 2/2] app/test-evnetdev: fix unchecked return value
  2019-11-21 19:22 [dpdk-stable] [dpdk-dev] [PATCH 1/2] app/test-eventdev: fix possible divide by zero pbhagavatula
@ 2019-11-21 19:22 ` pbhagavatula
  2019-11-26  5:18   ` Jerin Jacob
  2019-11-26  5:01 ` [dpdk-stable] [dpdk-dev] [PATCH 1/2] app/test-eventdev: fix possible divide by zero Jerin Jacob
  1 sibling, 1 reply; 4+ messages in thread
From: pbhagavatula @ 2019-11-21 19:22 UTC (permalink / raw)
  To: jerinj; +Cc: dev, Pavan Nikhilesh, stable

From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Fix unchecked return values reported by coverity.

Coverity Issue: 336861
Coverity Issue: 349906
Fixes: 032a965a8f1d ("app/eventdev: support Tx adapter")
Cc: stable@dpdk.org

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 app/test-eventdev/test_pipeline_common.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c
index 160461fb2..fa91bf229 100644
--- a/app/test-eventdev/test_pipeline_common.c
+++ b/app/test-eventdev/test_pipeline_common.c
@@ -196,7 +196,12 @@ pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt)
 		struct rte_eth_conf local_port_conf = port_conf;
 		uint32_t caps = 0;

-		rte_event_eth_tx_adapter_caps_get(opt->dev_id, i, &caps);
+		ret = rte_event_eth_tx_adapter_caps_get(opt->dev_id, i, &caps);
+		if (ret != 0) {
+			evt_err("failed to get event tx adapter[%d] caps", i);
+			return ret;
+		}
+
 		if (!(caps & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT))
 			t->internal_port = 0;

@@ -424,7 +429,7 @@ int
 pipeline_mempool_setup(struct evt_test *test, struct evt_options *opt)
 {
 	struct test_pipeline *t = evt_test_priv(test);
-	int i;
+	int i, ret;

 	if (!opt->mbuf_sz)
 		opt->mbuf_sz = RTE_MBUF_DEFAULT_BUF_SIZE;
@@ -437,7 +442,13 @@ pipeline_mempool_setup(struct evt_test *test, struct evt_options *opt)
 		uint16_t data_size = 0;

 		memset(&dev_info, 0, sizeof(dev_info));
-		rte_eth_dev_info_get(i, &dev_info);
+		ret = rte_eth_dev_info_get(i, &dev_info);
+		if (ret != 0) {
+			evt_err("Error during getting device (port %u) info: %s\n",
+				i, strerror(-ret));
+			return ret;
+		}
+
 		if (dev_info.rx_desc_lim.nb_mtu_seg_max != UINT16_MAX &&
 				dev_info.rx_desc_lim.nb_mtu_seg_max != 0) {
 			data_size = opt->max_pkt_sz /
--
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH 1/2] app/test-eventdev: fix possible divide by zero
  2019-11-21 19:22 [dpdk-stable] [dpdk-dev] [PATCH 1/2] app/test-eventdev: fix possible divide by zero pbhagavatula
  2019-11-21 19:22 ` [dpdk-stable] [dpdk-dev] [PATCH 2/2] app/test-evnetdev: fix unchecked return value pbhagavatula
@ 2019-11-26  5:01 ` Jerin Jacob
  1 sibling, 0 replies; 4+ messages in thread
From: Jerin Jacob @ 2019-11-26  5:01 UTC (permalink / raw)
  To: Pavan Nikhilesh; +Cc: Jerin Jacob, dpdk-dev, dpdk stable

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
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH 2/2] app/test-evnetdev: fix unchecked return value
  2019-11-21 19:22 ` [dpdk-stable] [dpdk-dev] [PATCH 2/2] app/test-evnetdev: fix unchecked return value pbhagavatula
@ 2019-11-26  5:18   ` Jerin Jacob
  0 siblings, 0 replies; 4+ messages in thread
From: Jerin Jacob @ 2019-11-26  5:18 UTC (permalink / raw)
  To: Pavan Nikhilesh; +Cc: Jerin Jacob, dpdk-dev, dpdk stable

On Fri, Nov 22, 2019 at 4:23 AM <pbhagavatula@marvell.com> wrote:
>
> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
>
> Fix unchecked return values reported by coverity.
>
> Coverity Issue: 336861
> Coverity Issue: 349906
> Fixes: 032a965a8f1d ("app/eventdev: support Tx adapter")
> Cc: stable@dpdk.org
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>

Changed the subject to "app/test-eventdev: fix unchecked return value"

Acked-by: Jerin Jacob <jerinj@marvell.com>
Applied to dpdk-next-eventdev/master. Thanks.

> ---
>  app/test-eventdev/test_pipeline_common.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c
> index 160461fb2..fa91bf229 100644
> --- a/app/test-eventdev/test_pipeline_common.c
> +++ b/app/test-eventdev/test_pipeline_common.c
> @@ -196,7 +196,12 @@ pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt)
>                 struct rte_eth_conf local_port_conf = port_conf;
>                 uint32_t caps = 0;
>
> -               rte_event_eth_tx_adapter_caps_get(opt->dev_id, i, &caps);
> +               ret = rte_event_eth_tx_adapter_caps_get(opt->dev_id, i, &caps);
> +               if (ret != 0) {
> +                       evt_err("failed to get event tx adapter[%d] caps", i);
> +                       return ret;
> +               }
> +
>                 if (!(caps & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT))
>                         t->internal_port = 0;
>
> @@ -424,7 +429,7 @@ int
>  pipeline_mempool_setup(struct evt_test *test, struct evt_options *opt)
>  {
>         struct test_pipeline *t = evt_test_priv(test);
> -       int i;
> +       int i, ret;
>
>         if (!opt->mbuf_sz)
>                 opt->mbuf_sz = RTE_MBUF_DEFAULT_BUF_SIZE;
> @@ -437,7 +442,13 @@ pipeline_mempool_setup(struct evt_test *test, struct evt_options *opt)
>                 uint16_t data_size = 0;
>
>                 memset(&dev_info, 0, sizeof(dev_info));
> -               rte_eth_dev_info_get(i, &dev_info);
> +               ret = rte_eth_dev_info_get(i, &dev_info);
> +               if (ret != 0) {
> +                       evt_err("Error during getting device (port %u) info: %s\n",
> +                               i, strerror(-ret));
> +                       return ret;
> +               }
> +
>                 if (dev_info.rx_desc_lim.nb_mtu_seg_max != UINT16_MAX &&
>                                 dev_info.rx_desc_lim.nb_mtu_seg_max != 0) {
>                         data_size = opt->max_pkt_sz /
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-21 19:22 [dpdk-stable] [dpdk-dev] [PATCH 1/2] app/test-eventdev: fix possible divide by zero pbhagavatula
2019-11-21 19:22 ` [dpdk-stable] [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 ` [dpdk-stable] [dpdk-dev] [PATCH 1/2] app/test-eventdev: fix possible divide by zero Jerin Jacob

patches for DPDK stable branches

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/ public-inbox