From a0b907330618b5df9868ff3bb3c26b41aaefb996 Mon Sep 17 00:00:00 2001 From: "Kasiewicz, Marek" Date: Mon, 17 Feb 2025 14:19:08 +0000 Subject: [PATCH] Fix: error handling in mt_af_xdp.c xsk_umem__create can return positive and negative values as error codes Signed-off-by: Kasiewicz, Marek --- lib/src/dev/mt_af_xdp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/dev/mt_af_xdp.c b/lib/src/dev/mt_af_xdp.c index dbe673ebc..5345e138b 100644 --- a/lib/src/dev/mt_af_xdp.c +++ b/lib/src/dev/mt_af_xdp.c @@ -317,13 +317,13 @@ static int xdp_umem_init(struct mt_xdp_priv* xdp, struct mt_xdp_queue* xq) { umem_size); ret = xsk_umem__create(&xq->umem, aligned_base_addr, umem_size, &xq->rx_prod, &xq->tx_cons, &cfg); - if (ret < 0) { + if (ret) { err("%s(%d,%u), umem create fail %d %s\n", __func__, port, q, ret, strerror(errno)); if (ret == -EPERM) err("%s(%d,%u), please add capability for the app: sudo setcap 'cap_net_raw+ep' " "\n", __func__, port, q); - return ret; + return -EINVAL; } xq->umem_buffer = aligned_base_addr;