From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH] dumpcap: check return value from adding interface
Date: Sun, 27 Oct 2024 11:28:48 -0700 [thread overview]
Message-ID: <20241027182903.209391-1-stephen@networkplumber.org> (raw)
The rte_pcapng_add_interface could fail.
For example: running out of space for the file.
Covertity issue: 446742
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
app/dumpcap/main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c
index fcfaa19951..260ca72dc6 100644
--- a/app/dumpcap/main.c
+++ b/app/dumpcap/main.c
@@ -800,9 +800,9 @@ static dumpcap_out_t create_output(void)
free(os);
TAILQ_FOREACH(intf, &interfaces, next) {
- rte_pcapng_add_interface(ret.pcapng, intf->port,
- intf->ifname, intf->ifdescr,
- intf->opts.filter);
+ if (rte_pcapng_add_interface(ret.pcapng, intf->port, intf->ifname,
+ intf->ifdescr, intf->opts.filter) < 0)
+ rte_exit(EXIT_FAILURE, "pcapng_add_interface %u failed\n", intf->port);
}
} else {
pcap_t *pcap;
--
2.45.2
next reply other threads:[~2024-10-27 18:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-27 18:28 Stephen Hemminger [this message]
2024-10-27 20:25 ` Morten Brørup
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=20241027182903.209391-1-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).