app/testpmd: use rte_rand() instead of random()
Checks
Commit Message
From: Pavan Nikhilesh <pbhagavatula@marvell.com>
Use rte_rand() instead of random() for better randomness.
Coverity Issue: 337666
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
app/test-pmd/txonly.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 11/21/2019 7:34 PM, pbhagavatula@marvell.com wrote:
> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
>
> Use rte_rand() instead of random() for better randomness.
>
> Coverity Issue: 337666
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Applied to dpdk-next-net/master, thanks.
@@ -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;