From patchwork Fri Mar 6 09:57:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 184238 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp7231469ile; Fri, 6 Mar 2020 02:00:03 -0800 (PST) X-Google-Smtp-Source: ADFU+vtjrS5hbMzS1Yrohv0Js6NC1N1APwBP9LyuqrawRN9xMswSfkOBBMm32+w+BH5xOAFOJOCM X-Received: by 2002:a05:6402:1d1a:: with SMTP id dg26mr2217903edb.260.1583488803118; Fri, 06 Mar 2020 02:00:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583488803; cv=none; d=google.com; s=arc-20160816; b=LlAQuG3kAz1y5beMJGYUUFcaMI+zI4gylrPbT5ECxaHxbqJ2pl80PhEVQgSqyDEwik S1xT84HRyrn/iEBaVDDFPCPc7P13jU2+ISR/orFfdF+w+9V9dlhdWxHxHuqQ2Yl1gTIX kn0LYtjq6LsAHcmoWl7L57GCEFpf6CpdNuuCzQ3mF5vYhP1/dm6d4yWCnXi/VFm2Uzm3 LJfIVgUyHDCWTTG2VuvZ4TJst+mil0KN7GOGOuMf7Y9q445oNR9qIAFDkUJ+agE+4gDX O/CTOWqoHYBxD2pqrvITx5yD6k9755QkOXwiiopxmPCBXh8epSXlEdiPBcWwpyy/wuDz ueLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:cc:to:from; bh=/Z0Lv5Ag9Pn/SNHwwnoj9gwOh+Z/OQgdZjsTu2OP4eU=; b=iKTQ+dgM8L2v4ExhQx1lluo1ECoiOJeLx7qMTsyfWPg6197vV9lykIkG9N5xInVisr u0vVXr3n6JbqwOG4PiXUA6qKHo0THzReUdkfHnMcrptsR9Q3Qs45N/yBGJEdgbFIkw74 Ozj8hdy5K9Y0ue38n4fKJlaFIXdxwD+7QYSBnlnk2Oa22NETG60RJ/RVMeI+XQmk2oYj 8tS+ZsbDZP2ci59DLuq1KUD6n2ds4Exhfe3MPiB/lH1Ps9aoAKoVhrjW18XsYD70FYIC kcbqrcOi6IlTbe3Y7816cQt3B0Jj5wWbMqnA1pIrSmBPAjt5/90pD3wepoB+1utCWBYf 1Ogg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id v22si1332775edq.37.2020.03.06.02.00.02; Fri, 06 Mar 2020 02:00:03 -0800 (PST) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 560CF1C002; Fri, 6 Mar 2020 10:59:48 +0100 (CET) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id 2931F1BFF2; Fri, 6 Mar 2020 10:59:46 +0100 (CET) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id A4350200AD2; Fri, 6 Mar 2020 10:59:45 +0100 (CET) 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 1EDA9200ADA; Fri, 6 Mar 2020 10:59:43 +0100 (CET) Received: from bf-netperf1.ap.com (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 4EFC7402D5; Fri, 6 Mar 2020 17:59:39 +0800 (SGT) From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@intel.com, stable@dpdk.org, Apeksha Gupta Date: Fri, 6 Mar 2020 15:27:28 +0530 Message-Id: <20200306095742.18080-3-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200306095742.18080-1-hemant.agrawal@nxp.com> References: <20200302145829.27808-1-hemant.agrawal@nxp.com> <20200306095742.18080-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v2 02/16] 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(-) -- 2.17.1 diff --git a/drivers/bus/fslmc/qbman/qbman_debug.c b/drivers/bus/fslmc/qbman/qbman_debug.c index 0bb2ce880..34374ae4b 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);