DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] dumpcap: check return value from adding interface
@ 2024-10-27 18:28 Stephen Hemminger
  2024-10-27 20:25 ` Morten Brørup
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2024-10-27 18:28 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

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


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

* RE: [PATCH] dumpcap: check return value from adding interface
  2024-10-27 18:28 [PATCH] dumpcap: check return value from adding interface Stephen Hemminger
@ 2024-10-27 20:25 ` Morten Brørup
  0 siblings, 0 replies; 2+ messages in thread
From: Morten Brørup @ 2024-10-27 20:25 UTC (permalink / raw)
  To: Stephen Hemminger, dev

Acked-by: Morten Brørup <mb@smartsharesystems.com>


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

end of thread, other threads:[~2024-10-27 20:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-27 18:28 [PATCH] dumpcap: check return value from adding interface Stephen Hemminger
2024-10-27 20:25 ` Morten Brørup

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