From patchwork Mon May 4 12:41:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 186107 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp83691ill; Mon, 4 May 2020 05:43:32 -0700 (PDT) X-Google-Smtp-Source: APiQypLPjwtGYq+CzRTLsCQis75ZuY2fxF+x3J9wljpYe3TvGPmObHMAAuFOQYnI/VDO1AXgqyxp X-Received: by 2002:a05:6402:14ce:: with SMTP id f14mr14307768edx.244.1588596212768; Mon, 04 May 2020 05:43:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588596212; cv=none; d=google.com; s=arc-20160816; b=rlGVnrrxmH0VAwaFo8+zWG6gzhpDjvRowRUfWOAqJTm9X9lexFzyrtyTp0ViFzBK+f ttFr4YETuFzxUSHtvSQOILIOn/WnTmFO+xYL7LFgGh94HkSCPjgsiUNof6u8YAGMesRw F+csenmN3rgOxSqhQbxxmFZNinG74RorjXl+0XbK7JaIqa57FFBIsD2OHkYJjvqwrDWB e3h0kTxv9LA2NyZdyK8aRyVM7CigPMgR8KVXN/EOoCBy2tGOBa6WSuB/slExl6cTw+Zj xQLeEnIuvMh+LWjwE2vSCcNo/i3IFrYWGl10wnbsl8t+cAS4W82veNEOxUlvDvcXLIeF K1sA== 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=kkYsygQsHSALPY4XoSMuk9OTi82wUv1X6rPLusmEtH8=; b=hrEbSbIACbJc2J7+1XJ7zKVXCFPL/bAV9qE30DBwRaVLJ10DErLRuO/jFoY/RcJQay 6CKayET4R/lhzJhTPZqvPaiqCYYWMxi++MaUjezHz3rri4SLerwXzXY/TlsltnVGYxwE AE36ziTXmhPPQa0pb0fCu47w+RI1nfjn2PNYcLnQCVL6FlM5NVsJvLL3LFbdJtnd1TCS SrdrwX6FLNdnD0Eme9Br24mnRx29H7/SpgEB5pGPxYxWnOZmrk+QAlu8hm+8U46osOhw tWQstdSi91AHudRm7vufFO8KdhYF+lhY4E5hTXbXt+MU/vHFSLvOVlJAHfLoq3NpTz9Y sw/A== 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 z5si8798756edi.111.2020.05.04.05.43.32; Mon, 04 May 2020 05:43:32 -0700 (PDT) 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 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(-) -- 2.17.1 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);