[dpdk-dev] [PATCH] app/testpmd: use rte_rand() instead of random()

pbhagavatula at marvell.com pbhagavatula at marvell.com
Thu Nov 21 20:34:06 CET 2019


From: Pavan Nikhilesh <pbhagavatula at marvell.com>

Use rte_rand() instead of random() for better randomness.

Coverity Issue: 337666

Signed-off-by: Pavan Nikhilesh <pbhagavatula at marvell.com>
---
 app/test-pmd/txonly.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c
index 539043c34..3caf281cb 100644
--- a/app/test-pmd/txonly.c
+++ b/app/test-pmd/txonly.c
@@ -159,7 +159,7 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp,
 	uint8_t i;
 
 	if (unlikely(tx_pkt_split == TX_PKT_SPLIT_RND))
-		nb_segs = random() % tx_pkt_nb_segs + 1;
+		nb_segs = rte_rand() % tx_pkt_nb_segs + 1;
 	else
 		nb_segs = tx_pkt_nb_segs;
 
-- 
2.17.1



More information about the dev mailing list