From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DBE0348A96; Fri, 7 Nov 2025 11:49:29 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1721640B8F; Fri, 7 Nov 2025 11:48:42 +0100 (CET) Received: from mx0a-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 650A64066C for ; Fri, 7 Nov 2025 11:48:40 +0100 (CET) Received: from pps.filterd (m0431384.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5A75XO7k1493227 for ; Fri, 7 Nov 2025 02:48:39 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=1 lHdbbUSqn2mUdoEWZ08p/248TCQtJ1k+pOWhzaFRH0=; b=VRV5ABbKpsgyvluFT 0HlR0BPdckqEge8VY/QsJFSMeFJG4Kd2kizx6NoroulKj+JJ23xZuC6fEZ3Mn6qd 6K2SRxybio4MT78/2WekCdP50jMx7TWtdfks/kh3bjQOH3JDXjBToo8UZOZYq85j IPRbS/HdBZS0SciqvsX3khh5Ry8vzU4aE1bxh152RUt+XUSNoTxedNS9/a9zVJCF 9ztNWfcp5RbwMh3GCDs15sWDzizNMuzC8M3K3PaZEn38CK+BUoAAgd/CjWh9xgdl 9ifzsl7Z3KOFOJw7d9S0aK8qMDZshWviPegck42oDx5Km2KP1QBpG1O7KopK0u5F 8a1rw== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 4a9aqkgvs1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 07 Nov 2025 02:48:39 -0800 (PST) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.25; Fri, 7 Nov 2025 02:48:38 -0800 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.25 via Frontend Transport; Fri, 7 Nov 2025 02:48:38 -0800 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id B1CC63F70C7; Fri, 7 Nov 2025 02:48:35 -0800 (PST) From: Nithin Dabilpuram To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Harman Kalra CC: , , Rakesh Kudurumalla Subject: [PATCH v4 15/23] common/cnxk: resolve klocwork issues Date: Fri, 7 Nov 2025 16:17:39 +0530 Message-ID: <20251107104747.1131008-15-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251107104747.1131008-1-ndabilpuram@marvell.com> References: <20250901073036.1381560-1-ndabilpuram@marvell.com> <20251107104747.1131008-1-ndabilpuram@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Authority-Analysis: v=2.4 cv=XvD3+FF9 c=1 sm=1 tr=0 ts=690dce87 cx=c_pps a=gIfcoYsirJbf48DBMSPrZA==:117 a=gIfcoYsirJbf48DBMSPrZA==:17 a=6UeiqGixMTsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=M5GUcnROAAAA:8 a=G8DdwVB4TRNb03k8HkUA:9 a=OBjm3rFKGHvpk9ecZwUJ:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTA3MDA4NyBTYWx0ZWRfX6qeawXOcEa9p 8WQiu6SbWCg8c/7+hRIWX5azjeslpkovT5c0++CBUA0xVfx0Ia71VfQlgyb4LF89CwYFqkivont njadlT0qHHeVWDgkl5zrp9/C81hANe8rBGrrAPO4uCZGXn3bGq7tU5AfCbvbN5IxTtfjE6DO4ik 8dpvEuBMjn8a0/oORy8fPqJmwDsptqWgzCXSCTwGF1muKgfmwjbnYlGdmQxdKh2H6KcbL1J9Rlq t4k4kKPX483B3G8K6EwlM/+I344AeiHJ9nTlmWTaPVqEucBI9pSfkzEoSuxjr9JZcBE/AElcWg+ e4lGJPSXCi11fbkcuTKyYjO3kreIBbSxUIc9XyaQUozx+Ic1j8Dtbb5v80TYqWrgCq7x3l3jdI1 HJj4SCfK8n71XCXQuQlZzaeSKY8u0g== X-Proofpoint-ORIG-GUID: vl8_5R4MJH14Gi42YDwFKpiKAtWaE63J X-Proofpoint-GUID: vl8_5R4MJH14Gi42YDwFKpiKAtWaE63J X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-11-07_02,2025-11-06_01,2025-10-01_01 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 From: Rakesh Kudurumalla Fix klockwork for NULL pointer dereference Signed-off-by: Rakesh Kudurumalla --- drivers/common/cnxk/roc_nix_queue.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/common/cnxk/roc_nix_queue.c b/drivers/common/cnxk/roc_nix_queue.c index 2c7fce1067..c7e37abf32 100644 --- a/drivers/common/cnxk/roc_nix_queue.c +++ b/drivers/common/cnxk/roc_nix_queue.c @@ -112,6 +112,11 @@ roc_nix_sq_ena_dis(struct roc_nix_sq *sq, bool enable) { int rc = 0; + if (!sq) { + rc = NIX_ERR_PARAM; + goto done; + } + rc = roc_nix_tm_sq_aura_fc(sq, enable); if (rc) goto done; @@ -2163,9 +2168,9 @@ nix_sqb_mem_dyn_free(uint64_t aura_handle, uint16_t count) int roc_nix_sq_fini(struct roc_nix_sq *sq) { - struct roc_nix *roc_nix = sq->roc_nix; - bool sq_resize_ena = roc_nix->sq_resize_ena; struct ndc_sync_op *ndc_req; + struct roc_nix *roc_nix; + bool sq_resize_ena; struct mbox *mbox; struct nix *nix; uint16_t qid; @@ -2174,6 +2179,9 @@ roc_nix_sq_fini(struct roc_nix_sq *sq) if (sq == NULL) return NIX_ERR_PARAM; + roc_nix = sq->roc_nix; + sq_resize_ena = roc_nix->sq_resize_ena; + nix = roc_nix_to_nix_priv(roc_nix); mbox = (&nix->dev)->mbox; @@ -2228,7 +2236,7 @@ sqb_aura_dyn_expand(struct roc_nix_sq *sq, uint16_t count) int i; blk_sz = nix->sqb_size; - sqbs = calloc(1, count * sizeof(uint64_t *)); + sqbs = calloc(1, count * sizeof(uint64_t)); if (!sqbs) return -ENOMEM; @@ -2300,7 +2308,7 @@ sqb_aura_dyn_contract(struct roc_nix_sq *sq, uint16_t count) cycles = (timeout * 10 * plt_tsc_hz()) / (uint64_t)1E6; cycles += plt_tsc_cycles(); - sqbs = calloc(1, count * sizeof(uint64_t *)); + sqbs = calloc(1, count * sizeof(uint64_t)); if (!sqbs) return -ENOMEM; -- 2.34.1