DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v1] net/memif: fix segfault with Tx burst larger than 255
@ 2023-12-05  4:05 Joyce Kong
  2023-12-05 18:33 ` Stephen Hemminger
  0 siblings, 1 reply; 4+ messages in thread
From: Joyce Kong @ 2023-12-05  4:05 UTC (permalink / raw)
  To: Jakub Grajciar, Morten Brørup, Joyce Kong, Ruifeng Wang
  Cc: dev, nd, stable, Liangxing Wang

There will be a segfault when tx burst size is larger than
256. This is because eth_memif_tx uses an index i which is
uint8_t to count transmitted nb_pkts. Extend i to uint16_t,
the same size as nb_pkts.

Fixes: b5613c8f9d0a ("net/memif: add a Tx fast path")
Cc: stable@dpdk.org

Reported-by: Liangxing Wang <liangxing.wang@arm.com>
Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 drivers/net/memif/rte_eth_memif.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index 7cc8c0da91..6f45a00172 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -684,7 +684,7 @@ eth_memif_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 		n_free = __atomic_load_n(&ring->head, __ATOMIC_ACQUIRE) - slot;
 	}
 
-	uint8_t i;
+	uint16_t i;
 	struct rte_mbuf **buf_tmp = bufs;
 	mbuf_head = *buf_tmp++;
 	struct rte_mempool *mp = mbuf_head->pool;
-- 
2.25.1


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

end of thread, other threads:[~2023-12-06 19:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-05  4:05 [PATCH v1] net/memif: fix segfault with Tx burst larger than 255 Joyce Kong
2023-12-05 18:33 ` Stephen Hemminger
2023-12-06  3:04   ` Joyce Kong
2023-12-06 19:17   ` Ferruh Yigit

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