Skip to content

Commit

Permalink
app/test-crypto-perf: fix invalid mbuf next operation
Browse files Browse the repository at this point in the history
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: bf9d670 ("app/crypto-perf: use single mempool")

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
  • Loading branch information
smou-mlnx authored and ovsrobot committed Jan 3, 2024
1 parent 6ef0715 commit 265431b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions app/test-crypto-perf/cperf_test_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 265431b

Please sign in to comment.