DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ciara Power <ciara.power@intel.com>
To: bruce.richardson@intel.com
Cc: dev@dpdk.org, Ciara Power <ciara.power@intel.com>,
	pawelx.modrak@intel.com, stable@dpdk.org
Subject: [dpdk-dev] [PATCH] examples/ioat: fix unchecked return value
Date: Tue,  4 Feb 2020 16:03:09 +0000	[thread overview]
Message-ID: <20200204160309.64827-1-ciara.power@intel.com> (raw)

The function call to get the device info can return negative values on
failure, which was previously unchecked. This return value is now
checked and the function exits on failure.

Coverity issue: 350361
Fixes: c8e6ceecebc1 ("examples/ioat: add new sample app for ioat driver")
Cc: pawelx.modrak@intel.com
Cc: stable@dpdk.org

Signed-off-by: Ciara Power <ciara.power@intel.com>
---
 examples/ioat/ioatfwd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/examples/ioat/ioatfwd.c b/examples/ioat/ioatfwd.c
index e9117718f..029f2f0ab 100644
--- a/examples/ioat/ioatfwd.c
+++ b/examples/ioat/ioatfwd.c
@@ -824,7 +824,10 @@ port_init(uint16_t portid, struct rte_mempool *mbuf_pool, uint16_t nb_queues)
 	/* Init port */
 	printf("Initializing port %u... ", portid);
 	fflush(stdout);
-	rte_eth_dev_info_get(portid, &dev_info);
+	ret = rte_eth_dev_info_get(portid, &dev_info);
+	if (ret < 0)
+		rte_exit(EXIT_FAILURE, "Error during getting device info:"
+			" err=%d, port=%u\n", ret, portid);
 	local_port_conf.rx_adv_conf.rss_conf.rss_hf &=
 		dev_info.flow_type_rss_offloads;
 	if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
-- 
2.17.1


             reply	other threads:[~2020-02-04 16:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-04 16:03 Ciara Power [this message]
2020-02-05 10:58 ` David Marchand
  -- strict thread matches above, loose matches on Subject: below --
2020-02-04 16:01 Ciara Power

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=20200204160309.64827-1-ciara.power@intel.com \
    --to=ciara.power@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=pawelx.modrak@intel.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).