DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] app/test-crypto-perf: fix invalid mbuf next operation
@ 2024-01-03  3:53 Suanming Mou
  2024-01-03 11:21 ` [EXT] " Anoob Joseph
  2024-01-04  2:24 ` [PATCH v2] " Suanming Mou
  0 siblings, 2 replies; 9+ messages in thread
From: Suanming Mou @ 2024-01-03  3:53 UTC (permalink / raw)
  To: Ciara Power; +Cc: dev

In fill_multi_seg_mbuf(), when remaining_segments is 0,
rte_mbuf m's next should pointer to NULL instead of a
new rte_mbuf, that casues setting m->next as NULL out
of the while loop to the invalid mbuf.

This commit fixes the invalid mbuf next operation.

Fixes: bf9d6702eca9 ("app/crypto-perf: use single mempool")

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
---
 app/test-crypto-perf/cperf_test_common.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/app/test-crypto-perf/cperf_test_common.c b/app/test-crypto-perf/cperf_test_common.c
index 932aab16df..ad2076dd2e 100644
--- a/app/test-crypto-perf/cperf_test_common.c
+++ b/app/test-crypto-perf/cperf_test_common.c
@@ -72,13 +72,15 @@ fill_multi_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp,
 		rte_mbuf_refcnt_set(m, 1);
 		next_mbuf = (struct rte_mbuf *) ((uint8_t *) m +
 					mbuf_hdr_size + segment_sz);
-		m->next = next_mbuf;
-		m = next_mbuf;
-		remaining_segments--;
 
+		remaining_segments--;
+		if (remaining_segments > 0) {
+			m->next = next_mbuf;
+			m = next_mbuf;
+		} else {
+			m->next = NULL;
+		}
 	} while (remaining_segments > 0);
-
-	m->next = NULL;
 }
 
 static void
-- 
2.34.1


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

end of thread, other threads:[~2024-02-01  8:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-03  3:53 [PATCH] app/test-crypto-perf: fix invalid mbuf next operation Suanming Mou
2024-01-03 11:21 ` [EXT] " Anoob Joseph
2024-01-03 12:35   ` Suanming Mou
2024-01-03 15:42     ` Anoob Joseph
2024-01-04  2:23       ` Suanming Mou
2024-01-04  2:24 ` [PATCH v2] " Suanming Mou
2024-01-04  4:17   ` [EXT] " Anoob Joseph
2024-01-12 16:04   ` Power, Ciara
2024-02-01  8:45   ` [EXT] " Akhil Goyal

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