[PATCH v3 06/14] test/bpf: fix error handling in ELF load tests

Stephen Hemminger
2026-01-22T00:54:45Z

Address related issues found during review
- Add missing TEST_ASSERT for mempool creation in test_bpf_elf_tx_load
- Initialize port variable in test_bpf_elf_rx_load to avoid undefined
behavior in cleanup path if null_vdev_setup fails early

Fixes: cf1e03f881af ("test/bpf: add ELF loading")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Marat Khalili <marat.khalili@huawei.com>
---
app/test/test_bpf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/app/test/test_bpf.c b/app/test/test_bpf.c
index a7d56f8d86..0e969f9f13 100644
--- a/app/test/test_bpf.c
+++ b/app/test/test_bpf.c
@@ -3580,6 +3580,7 @@ test_bpf_elf_tx_load(void)
mb_pool = rte_pktmbuf_pool_create("bpf_tx_test_pool", BPF_TEST_POOLSIZE,
0, 0, RTE_MBUF_DEFAULT_BUF_SIZE,
SOCKET_ID_ANY);
+ TEST_ASSERT(mb_pool != NULL, "failed to create mempool");

ret = null_vdev_setup(null_dev, &port, mb_pool);
if (ret != 0)
@@ -3664,7 +3665,7 @@ test_bpf_elf_rx_load(void)
static const char null_dev[] = "net_null_bpf0";
struct rte_mempool *pool = NULL;
char *tmpfile = NULL;
- uint16_t port;
+ uint16_t port = UINT16_MAX;
int ret;

printf("%s start\n", __func__);
--
2.51.0