From 26a2e095473ba20af7f2f81aafef002145184af9 Mon Sep 17 00:00:00 2001 From: Xavier Simonart Date: Sat, 13 Jan 2018 21:44:49 +0100 Subject: Fix potential crash in rx and tx distribution In some (rare) modes, more than 64 packets can be received through one rx function. This is for instance the case of the lat mode. Change-Id: Ie733c927a8e116c679c464f2551768185ef85366 Signed-off-by: Xavier Simonart --- VNFs/DPPD-PROX/rx_pkt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'VNFs/DPPD-PROX/rx_pkt.c') diff --git a/VNFs/DPPD-PROX/rx_pkt.c b/VNFs/DPPD-PROX/rx_pkt.c index fd0f7e5c..f6adeb4b 100644 --- a/VNFs/DPPD-PROX/rx_pkt.c +++ b/VNFs/DPPD-PROX/rx_pkt.c @@ -476,7 +476,10 @@ uint16_t rx_pkt_distr(struct task_base *tbase, struct rte_mbuf ***mbufs) { uint16_t ret = call_prev_rx_pkt(tbase, mbufs); - tbase->aux->rx_bucket[ret]++; + if (likely(ret < RX_BUCKET_SIZE)) + tbase->aux->rx_bucket[ret]++; + else + tbase->aux->rx_bucket[RX_BUCKET_SIZE - 1]++; return ret; } -- cgit 1.2.3-korg