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 874E8A04AF; Mon, 4 May 2020 14:43:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E72D71D167; Mon, 4 May 2020 14:43:26 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id E5BC11D15D; Mon, 4 May 2020 14:43:25 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 6B8A01A034D; Mon, 4 May 2020 14:43:25 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 5FA061A034C; Mon, 4 May 2020 14:43: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 70373402DB; Mon, 4 May 2020 20:43:20 +0800 (SGT) From: Hemant Agrawal To: dev@dpdk.org, ferruh.yigit@intel.com Cc: stable@dpdk.org, Apeksha Gupta Date: Mon, 4 May 2020 18:11:11 +0530 Message-Id: <20200504124118.22877-2-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200504124118.22877-1-hemant.agrawal@nxp.com> References: <20200306095742.18080-1-hemant.agrawal@nxp.com> <20200504124118.22877-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v3 1/8] 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 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/bus/fslmc/qbman/qbman_debug.c b/drivers/bus/fslmc/qbman/qbman_debug.c index 0bb2ce880f..34374ae4b6 100644 --- a/drivers/bus/fslmc/qbman/qbman_debug.c +++ b/drivers/bus/fslmc/qbman/qbman_debug.c @@ -20,26 +20,27 @@ struct qbman_fq_query_desc { uint8_t verb; uint8_t reserved[3]; uint32_t fqid; - uint8_t reserved2[57]; + uint8_t reserved2[56]; }; 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