Skip to contentSkip to conversation

test/pmd_af_packet: cleanups

PATCH Applied Stephen Hemminger 2 participants 2 messages Jun 22 – Nov 12

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test/pmd_af_packet: cleanups

Fix two coverity bugs where fcntl() return value not checked. Also mark some other cases as FAILED instead of skipped. Such as failure to transmit or failure to allocate mbuf's.

Coverity ID: 503765
Coverity ID: 503766

---
 app/test/test_pmd_af_packet.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
app/test/test_pmd_af_packet.c +8 -5
index b668ca5b81..9fe595d606 100644
@@ -556,19 +556,22 @@ test_af_packet_loopback(void)
 
 	/* Set TAP fd to non-blocking for reading */
 	int flags = fcntl(tap_fd, F_GETFL, 0);
-	fcntl(tap_fd, F_SETFL, flags | O_NONBLOCK);
+	if (flags < 0 || fcntl(tap_fd, F_SETFL, flags | O_NONBLOCK) < 0) {
+		printf("fcntl failed: %s\n", strerror(errno));
+		return TEST_FAILED;
+	}
 
 	/* Allocate and send packets */
 	allocated = alloc_tx_mbufs(tx_bufs, BURST_SIZE);
 	if (allocated == 0) {
-		printf("SKIPPED: Could not allocate mbufs\n");
-		return TEST_SKIPPED;
+		printf("Could not allocate mbufs\n");
+		return TEST_FAILED;
 	}
 
 	nb_tx = do_tx_burst(port_id, 0, tx_bufs, allocated);
 	if (nb_tx == 0) {
-		printf("SKIPPED: No packets transmitted\n");
-		return TEST_SKIPPED;
+		printf("No packets transmitted\n");
+		return TEST_FAILED;
 	}
 
 	/*
Signature · 1 line
2.53.0
#1 lore raw

23/06/2026 01:21, Stephen Hemminger:

Quoted 8 lines

Fix two coverity bugs where fcntl() return value not checked. Also mark some other cases as FAILED instead of skipped. Such as failure to transmit or failure to allocate mbuf's.

Coverity ID: 503765
Coverity ID: 503766

Applied, thanks.