From patchwork Fri May 8 13:02:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 186335 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp4157722ill; Fri, 8 May 2020 06:04:32 -0700 (PDT) X-Google-Smtp-Source: APiQypLtFA4k5gAQC2Jzyor2kfJStYk8jeLWVR1Rpdj64mXs1c1KBthxBT/a34PFFMzudF+HaOiM X-Received: by 2002:a50:9e2a:: with SMTP id z39mr2122764ede.371.1588943072007; Fri, 08 May 2020 06:04:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588943072; cv=none; d=google.com; s=arc-20160816; b=nuwkZ4VnQobZr89zkUbrDkBHgJXnJB1CzWHzpH5WdpBIqd6aASZcqBQG+6/KIYzOQM EEFd1NqLLbxl7CbMagoKzfU6PWYbWObVvh855Pu1FXrEVtee7jDpuqjN9pjHyibsSYPD cWRBxZsngW16GDXlf+rV/BfiRFsvAZRzUTibZkc/vwTUpiPNu8axf/WwvPfKnkfpGlJF 76ZbhCkYHjCvbAsA79OKfPF7o/WlHQjRVi5hTluCYcMmQ0YesuqPnI5q31xxCz2hUhRQ FtujB0D0eoI+OjiTXMP1ePAVTSJrQOysk5NYoui8XNPvLNFKCmLDOupnGId1t+1vb4Yo 3N/Q== 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=/to1Eu13YE64aeh92+9eSUIk7gyZjhEoYDVwpYa7Vhk=; b=xY3ZcVZIgBmdzoJjRdbHo1+OckiHIRSWTELE2xyC+RQjATmdVQTFaBr+rPfHUOoqDC BbI6A4EgAbTW0xmsd30YPESd2tqeywkw9rIEjyNLSYQwKPZlz9xFqPCQGMKy4BbHhQ2W 7IWfeA1z0knbuKcyMHioqShJY5M2KKE8caZvjAB86uDxkvHCt0HOm7VFlwAouXnjFngH YhbIU8qYx3NKKa0b9Asa0QDfOeV4tXah0rlMaOhgOkfw4J/5ux2ShxGrzvkxch/WLPls qCXR9jKpCHya+ANGh9FBlce0cI2M/bmmXXGfM+6cSyXQYMsJ0zNuDwlHtG0h7JooPsLC BpRA== 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 ce21si994078edb.297.2020.05.08.06.04.31; Fri, 08 May 2020 06:04:31 -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 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(-) -- 2.17.1 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);