DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Chautru, Nicolas" <nicolas.chautru@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>,
	"dev@dpdk.org" <dev@dpdk.org>
Cc: "Vargas, Hernan" <hernan.vargas@intel.com>
Subject: RE: [PATCH 6/6] baseband/fpga_5gnr: don't use rand()
Date: Sat, 2 Mar 2024 01:07:41 +0000	[thread overview]
Message-ID: <BY5PR11MB44515317F8EFDDA988666FFEF85D2@BY5PR11MB4451.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20240301175842.159967-7-stephen@networkplumber.org>


> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Friday, March 1, 2024 9:57 AM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>; Vargas, Hernan
> <hernan.vargas@intel.com>; Chautru, Nicolas <nicolas.chautru@intel.com>
> Subject: [PATCH 6/6] baseband/fpga_5gnr: don't use rand()
> 
> The function rand is very weak and should not be used.
> Use the DPDK rte_rand() which is seeded from entropy instead.
> 
> Coverity issue: 414987
> Fixes: b3d326e438f1 ("baseband/fpga_5gnr_fec: add FPGA mutex")
> Cc: hernan.vargas@intel.com
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Acked-by: Nicolas Chautru <nicolas.chautru@intel.com>

> ---
>  drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
> b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
> index efc1d3a7725b..9b253cde280d 100644
> --- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
> +++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
> @@ -14,6 +14,7 @@
>  #include <bus_pci_driver.h>
>  #include <rte_byteorder.h>
>  #include <rte_cycles.h>
> +#include <rte_random.h>
> 
>  #include <rte_bbdev.h>
>  #include <rte_bbdev_pmd.h>
> @@ -1990,7 +1991,7 @@ fpga_5gnr_mutex_acquisition(struct
> fpga_5gnr_queue *q)  {
>  	uint32_t mutex_ctrl, mutex_read, cnt = 0;
>  	/* Assign a unique id for the duration of the DDR access */
> -	q->ddr_mutex_uuid = rand();
> +	q->ddr_mutex_uuid = rte_rand();
>  	/* Request and wait for acquisition of the mutex */
>  	mutex_ctrl = (q->ddr_mutex_uuid << 16) + 1;
>  	do {
> --
> 2.43.0


  parent reply	other threads:[~2024-03-02  1:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-01 17:57 [PATCH 0/6] Coverity related fixes Stephen Hemminger
2024-03-01 17:57 ` [PATCH 1/6] test/bpf: make sure mbuf is initialized Stephen Hemminger
2024-03-01 18:09   ` Tyler Retzlaff
2024-03-01 17:57 ` [PATCH 2/6] net/tap: log if netlink ext ack not possible Stephen Hemminger
2024-03-01 17:57 ` [PATCH 3/6] examples/l2fwd-keepalive: use rte_drand_max Stephen Hemminger
2024-03-01 17:57 ` [PATCH 4/6] net/qede: replace use of rand() Stephen Hemminger
2024-03-01 18:10   ` Tyler Retzlaff
2024-03-01 17:57 ` [PATCH 5/6] pipeline: " Stephen Hemminger
2024-03-01 18:11   ` Tyler Retzlaff
2024-03-01 17:57 ` [PATCH 6/6] baseband/fpga_5gnr: don't use rand() Stephen Hemminger
2024-03-01 18:11   ` Tyler Retzlaff
2024-03-02  1:07   ` Chautru, Nicolas [this message]
2024-03-06 20:08 ` [PATCH 0/6] Coverity related fixes David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BY5PR11MB44515317F8EFDDA988666FFEF85D2@BY5PR11MB4451.namprd11.prod.outlook.com \
    --to=nicolas.chautru@intel.com \
    --cc=dev@dpdk.org \
    --cc=hernan.vargas@intel.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).