DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH 1/3] pcapng: handle rte_ethlink_get failing
Date: Thu, 10 Feb 2022 15:09:04 -0800	[thread overview]
Message-ID: <20220210230906.833163-2-stephen@networkplumber.org> (raw)
In-Reply-To: <20220210230906.833163-1-stephen@networkplumber.org>

If rte_ethlink_get fails, the code can just not add speed
to the pcap file.

Coverity issue: 373664
Fixes: 8d23ce8f5ee9 ("pcapng: add new library for writing pcapng files")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/pcapng/rte_pcapng.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 03edabe73e96..9db058fe422b 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -177,8 +177,8 @@ pcapng_add_interface(rte_pcapng_t *self, uint16_t port)
 			 "%s-%s", dev->bus->name, dev->name);
 
 	/* DPDK reports in units of Mbps */
-	rte_eth_link_get(port, &link);
-	if (link.link_status == RTE_ETH_LINK_UP)
+	if (rte_eth_link_get(port, &link) == 0 &&
+	    link.link_status == RTE_ETH_LINK_UP)
 		speed = link.link_speed * PCAPNG_MBPS_SPEED;
 
 	if (rte_eth_macaddr_get(port, &macaddr) < 0)
-- 
2.34.1


  reply	other threads:[~2022-02-10 23:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-10 23:09 [PATCH 0/3] small fixes suggested by Coverity scan Stephen Hemminger
2022-02-10 23:09 ` Stephen Hemminger [this message]
2022-02-10 23:09 ` [PATCH 2/3] app/test_bpf: don't print eBPF program if NULL Stephen Hemminger
2022-02-11 11:02   ` Ananyev, Konstantin
2022-02-10 23:09 ` [PATCH 3/3] app/dumpcap: check for failure to set promiscious Stephen Hemminger
2022-03-08  8:20 ` [PATCH 0/3] small fixes suggested by Coverity scan 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=20220210230906.833163-2-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --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).