From patchwork Fri Mar 1 17:57:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 137770 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4389543BCF; Fri, 1 Mar 2024 18:59:30 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E241043400; Fri, 1 Mar 2024 18:59:02 +0100 (CET) Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by mails.dpdk.org (Postfix) with ESMTP id 79AA2433CA for ; Fri, 1 Mar 2024 18:58:58 +0100 (CET) Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-6e56787e691so2351448b3a.0 for ; Fri, 01 Mar 2024 09:58:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1709315938; x=1709920738; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mWyTkg4hZ5fjAqOOVXuZ7rMRAo8qhuFycorX5UVx1sI=; b=XDcrh9r3ll17Ftvo8dRPYaz/YcSuPGcyuJVqfmRzlqyOd6nSOvTZSQwYpAlsyi181K JiwBTJ/DQI109rG2h0N++Q18x7HbeNRm59xJ3V+ITaStPts4yXje9SB3jVWIvCZ+iQoi FGm6aI0NMTP5P11YxBK8YmY4BwG7yL2f0Xkcy9LP0h1ADBdF3gD5FjHYTKw2IjNLdjWW XVVrl56LQH39ITtajO0CjdSiwCTSBwapAB+/G9lgf5GP/bSPw8BHIJjmy5YYAAG9zsUr aCw9p8Orq62z3qXVHpa7dfDMFTGHlK4MmGU5R7jWFXfzUuHsoQnfZObpmXt/q59ose2v 1vUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709315938; x=1709920738; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mWyTkg4hZ5fjAqOOVXuZ7rMRAo8qhuFycorX5UVx1sI=; b=A1oGEtP7k6arRZm+pGTyUx/s8jtcSMUeprqoAufhQMYprNOCeDduCVEeLffQQK2cn9 FwbzGk0faXFNGx3TQGEh9bKna7nEJuBHL9YvYiqvYHSR5tq2uK/kCCosGo/T4+PECoXF XNCvAvBJ5kHt82x4fkLSc47jwc9rBcCoF5HRaBkj/945vzHyN7ij7tsTT+ipsUbQFOnO bpq2hkpiDXkbwg6RN4LYgoJWPF3EWaUVZjdAjI33NvTPm/5RAQlS1nsUjevK4wYxpDIK OjEsOivhachuqe5a/vNCWgGqxqes6gkcsyOHE6A2CROC/xmwYS58FYRkHIL9h6Evoeo+ fnqg== X-Gm-Message-State: AOJu0YwHXY5dLaoyHXIq9EI2ZbAlkXbfsexwbiM2VnQo7lmP5nVloKqH 3SdKH644ELxEr8A7nL4CRSQ6cyo5YOa4GbXo1EsNMdHLeubGsvhIQedp9/ElUeV2aaMnVQAkW2L FD+wTcw== X-Google-Smtp-Source: AGHT+IHgd9fis+VHtvDilLw7ziU+eaGLAd0IN5JEY8Q39vWonH4iUeioN2k2kCUUfILNDVCqsUWbng== X-Received: by 2002:a05:6a20:144c:b0:1a0:f3f4:3b1a with SMTP id a12-20020a056a20144c00b001a0f3f43b1amr3080858pzi.10.1709315937715; Fri, 01 Mar 2024 09:58:57 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id bw7-20020a056a02048700b005e438ea2a5asm2938828pgb.53.2024.03.01.09.58.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 09:58:57 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , hernan.vargas@intel.com, Nicolas Chautru Subject: [PATCH 6/6] baseband/fpga_5gnr: don't use rand() Date: Fri, 1 Mar 2024 09:57:11 -0800 Message-ID: <20240301175842.159967-7-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240301175842.159967-1-stephen@networkplumber.org> References: <20240301175842.159967-1-stephen@networkplumber.org> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 Reviewed-by: Tyler Retzlaff Acked-by: Nicolas Chautru --- 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 #include #include +#include #include #include @@ -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 {