From patchwork Mon Mar 2 14:58:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 184074 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp2191733ile; Mon, 2 Mar 2020 01:26:53 -0800 (PST) X-Google-Smtp-Source: APXvYqyyiaaqvfPeGyCcEiFOalCnj5TGWQye3y6HxOPaw0uimiA6XKjtYjDRQCuYTR1XBqFuaiGT X-Received: by 2002:a50:fb0b:: with SMTP id d11mr15176383edq.252.1583141213230; Mon, 02 Mar 2020 01:26:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583141213; cv=none; d=google.com; s=arc-20160816; b=dEvqhe1jhj5jdma/CZcH2AMRECMrLzWGYqeeFy+xnFbCq4d0fHWyAjsEXbxR0Mepgo UXkPHfgBHcIUL0SBFCoKG7773/iUz2Cb733pqvhF0BpiuCkEoTlijrQGVPMP3lQKTVr7 MLGqhbfJC+J8uHXu0sG2KTMufH/EAqNfB4Tdl5/Iq2ZAennIqYlFIgAyQGdIA+JxnwW5 RGjs6NPY8fLohMX1arfMVl36monm8xqFHQY9l8uaaCe1pVwwZAdvZZ5ytq0n2K+QN20X rBtAnv4lUAJPiv5bqjHLoiXyMkviveJsLPzqreh8smnHHyBq2c6rVpprCWB2sKk3EA3/ 61yA== 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=ZbHKoI2S5ZUPn2WiNuG5dqXAEw48sRO8qCOj+1sH7K11pcYxtsg4e9wKsFt8CSWbTN enqq0i36//zqNj+mbSHXBKX5RZsDRsuGj2gqogC5YcgrjEy6BBymsNmdkvG1ydcvdGVz Uxge00zbseLoH0yxr4Ac5TKpFWGobI2kh3/5j/oBNq4W+7XY/Rhcc+eVp+PxezW5Qkou 5nZ2214xtyyT665m7Yk4uj7IdCvpM0otOa9DQjiTsyZqrF/CYfxhthNT/hRgNIsObDUO RbD1UpMRRzIIBC41ebVz8+WZ4ooEtrQA/ngZTm2UFWu1F4uWATxl/Rxo+NKg8GDKFXDp /OeA== 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 rp17si6541150ejb.428.2020.03.02.01.26.53; Mon, 02 Mar 2020 01:26:53 -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 7B8E71C022; Mon, 2 Mar 2020 10:26:38 +0100 (CET) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id E012E4C9D; Mon, 2 Mar 2020 10:26:35 +0100 (CET) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id C0E651A0FBB; Mon, 2 Mar 2020 10:26:35 +0100 (CET) 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 40EE81A0FAD; Mon, 2 Mar 2020 10:26:33 +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 61EEC402A7; Mon, 2 Mar 2020 17:26:29 +0800 (SGT) From: Hemant Agrawal To: ferruh.yigit@intel.com Cc: dev@dpdk.org, stable@dpdk.org, Apeksha Gupta Date: Mon, 2 Mar 2020 20:28:15 +0530 Message-Id: <20200302145829.27808-3-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200302145829.27808-1-hemant.agrawal@nxp.com> References: <20200302145829.27808-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH 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);