From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 79106A00C5; Fri, 8 May 2020 15:04:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 98F511DB2A; Fri, 8 May 2020 15:04:27 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id 7A6B81DB11; Fri, 8 May 2020 15:04:25 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 5B2302013A1; Fri, 8 May 2020 15:04:25 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 5740420100F; Fri, 8 May 2020 15:04:23 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 59E1540302; Fri, 8 May 2020 21:04:20 +0800 (SGT) From: Hemant Agrawal To: dev@dpdk.org, ferruh.yigit@intel.com Cc: stable@dpdk.org, Apeksha Gupta Date: Fri, 8 May 2020 18:32:02 +0530 Message-Id: <20200508130211.14334-2-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200508130211.14334-1-hemant.agrawal@nxp.com> References: <20200507104645.31990-1-hemant.agrawal@nxp.com> <20200508130211.14334-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v6 01/10] bus/fslmc: fix dereferencing null pointer X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Apeksha Gupta This patch fixees the nxp internal coverity reported null pointer dereferncing issue. Fixes: 6fef517e17cf ("bus/fslmc: add qman HW fq query count API") Cc: stable@dpdk.org Signed-off-by: Apeksha Gupta --- drivers/bus/fslmc/qbman/qbman_debug.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/bus/fslmc/qbman/qbman_debug.c b/drivers/bus/fslmc/qbman/qbman_debug.c index 0bb2ce880f..4cd0923acb 100644 --- a/drivers/bus/fslmc/qbman/qbman_debug.c +++ b/drivers/bus/fslmc/qbman/qbman_debug.c @@ -27,19 +27,20 @@ int qbman_fq_query_state(struct qbman_swp *s, uint32_t fqid, struct qbman_fq_query_np_rslt *r) { struct qbman_fq_query_desc *p; + struct qbman_fq_query_np_rslt *var; p = (struct qbman_fq_query_desc *)qbman_swp_mc_start(s); if (!p) return -EBUSY; p->fqid = fqid; - *r = *(struct qbman_fq_query_np_rslt *)qbman_swp_mc_complete(s, p, - QBMAN_FQ_QUERY_NP); - if (!r) { + var = qbman_swp_mc_complete(s, p, QBMAN_FQ_QUERY_NP); + if (!var) { pr_err("qbman: Query FQID %d NP fields failed, no response\n", fqid); return -EIO; } + *r = *var; /* Decode the outcome */ QBMAN_BUG_ON((r->verb & QBMAN_RESPONSE_VERB_MASK) != QBMAN_FQ_QUERY_NP); -- 2.17.1