DPDK patches and discussions
 help / color / Atom feed
* [dpdk-dev] [PATCH] app/testpmd: use rte_rand() instead of random()
@ 2019-11-21 19:34 pbhagavatula
  2019-11-22 16:38 ` Ferruh Yigit
  0 siblings, 1 reply; 2+ messages in thread
From: pbhagavatula @ 2019-11-21 19:34 UTC (permalink / raw)
  To: jerinj, Wenzhuo Lu, Jingjing Wu, Bernard Iremonger; +Cc: dev, Pavan Nikhilesh

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

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


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

* Re: [dpdk-dev] [PATCH] app/testpmd: use rte_rand() instead of random()
  2019-11-21 19:34 [dpdk-dev] [PATCH] app/testpmd: use rte_rand() instead of random() pbhagavatula
@ 2019-11-22 16:38 ` Ferruh Yigit
  0 siblings, 0 replies; 2+ messages in thread
From: Ferruh Yigit @ 2019-11-22 16:38 UTC (permalink / raw)
  To: pbhagavatula, jerinj, Wenzhuo Lu, Jingjing Wu, Bernard Iremonger; +Cc: dev

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.


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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-21 19:34 [dpdk-dev] [PATCH] app/testpmd: use rte_rand() instead of random() pbhagavatula
2019-11-22 16:38 ` Ferruh Yigit

DPDK patches and discussions

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ http://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox