Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp643286pxb; Wed, 3 Feb 2021 14:02:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJxvPILGuRpAyOFSQCxrvN2YdpSDNW6p3PNvmydBZObFeiz+URnkO7MVqmHqXN6vdeggi/E3 X-Received: by 2002:a17:906:bcd4:: with SMTP id lw20mr5318775ejb.415.1612389732856; Wed, 03 Feb 2021 14:02:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612389732; cv=none; d=google.com; s=arc-20160816; b=FUaRAGv8JSeHzCyWFpr4jA8kxCtlq2DX6VoAMqz9wc4Y1q9QZzqvth/H+fL+t9JSKL QCKS5e9oWEozd/pVBiHX+XV0GhC8rsI5IFGTrUuCyl4r2z3b7/2FNbEYK/kvkQoz6EbB bmiw/paRQQWr6sYyQhuVsBq6LURcbQaksqjcf/f+hqgSaHlTfNgtERVNjrVyfwOut9cD v3NzJ50Wy7AxBiJLI4DNNIrKv5QmS27CFfNYZQAT4uQOJYeEPNNui5sGVEAZXJyFwmMr PA2kNkqAxwGv8f9D5mAQmalasYsAMsFv2Ez8gxiuefSYk/WR2Zh3+yYN8fnkdzzVgLbY i1tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=pCyObRoYs4TuqGUabO/rMbP3htemyH/3g4S6VzT5G0o=; b=aGJQBGEUEbWMBXUPnr90/vKv5KzD0uuDXOytSr6B80igukze3SI630GFVX9l1E0ru9 ujpEuKksZCNV0Kbf4yV5Eey4CMrGlruacq+kQfqnHMZj4WhQAjQpxBhxyHk3HV0YMWYc 6Dkhn6+p8OIvtyUAcIb4wzvH/XnTtzlC68ysMkC7uHJ0NkRPaATb7tSP1uzQj7LmBips DvtAOhMnKuCgS6K2ClrwK5SrZhlevxUc73lsyQjKMrSjVO4mcAOwYJvPTERbrJHwqCRI 5LrhnrOp/vBK+j1N3oSClEQorYBSJ5qiVX2aSEHakVbRkzmxH0TAu9vFhLI6UrR4OJtg swuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=kX3rv6W8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ov18si1479947ejb.145.2021.02.03.14.01.48; Wed, 03 Feb 2021 14:02:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=kX3rv6W8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232467AbhBCWA0 (ORCPT + 99 others); Wed, 3 Feb 2021 17:00:26 -0500 Received: from smtprelay-out1.synopsys.com ([149.117.73.133]:60294 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232676AbhBCV71 (ORCPT ); Wed, 3 Feb 2021 16:59:27 -0500 Received: from mailhost.synopsys.com (mdc-mailhost1.synopsys.com [10.225.0.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 88665404A2; Wed, 3 Feb 2021 21:58:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1612389507; bh=RPtJq9pnB6c2RL81eMcBv6mkc0ffZocP1N1iwYCqspQ=; h=From:To:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=kX3rv6W8jpQMgcUnj1fJtWr7khaXJiGnxuK/XNzQky87qosdjILdZuuZzX2XWHG49 z9PUg2lReIHRlQTsJECetpah4VOdnKmzou+QHvpVDANsX2K5o+1cXn+aNJpF6cTMYj 3F0sAvlm3+DFitGo1bP/oFAfj73yFKgJPW0yd+JBLqhgF3j4+Xz8R5dgdDEs0vqR29 FU2gVJG1UbhlKiUFgcDrQACvUSF7z4D/ohk3ll+HdlyNeOqiHGooaa/9zKJc/nvKOc IBPrUO7Pd6+KVI3K9c1Ys2h30kTXv4ji0TjXAK7jwWRijewCdUxm3EpMthno/FEzVj ZyheGfgmaZbew== Received: from de02dwia024.internal.synopsys.com (de02dwia024.internal.synopsys.com [10.225.19.81]) by mailhost.synopsys.com (Postfix) with ESMTP id 60E24A024B; Wed, 3 Feb 2021 21:58:26 +0000 (UTC) X-SNPS-Relay: synopsys.com From: Gustavo Pimentel To: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, Vinod Koul , Dan Williams , Bjorn Helgaas , Gustavo Pimentel Subject: [PATCH v4 15/15] dmaengine: dw-edma: Add pcim_iomap_table return checker Date: Wed, 3 Feb 2021 22:58:06 +0100 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Detected by CoverityScan CID 16555 ("Dereference null return") Signed-off-by: Gustavo Pimentel --- drivers/dma/dw-edma/dw-edma-pcie.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/dma/dw-edma/dw-edma-pcie.c b/drivers/dma/dw-edma/dw-edma-pcie.c index 686b4ff..7445033 100644 --- a/drivers/dma/dw-edma/dw-edma-pcie.c +++ b/drivers/dma/dw-edma/dw-edma-pcie.c @@ -238,6 +238,9 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, dw->rd_ch_cnt = vsec_data.rd_ch_cnt; dw->rg_region.vaddr = pcim_iomap_table(pdev)[vsec_data.rg.bar]; + if (!dw->rg_region.vaddr) + return -ENOMEM; + dw->rg_region.vaddr += vsec_data.rg.off; dw->rg_region.paddr = pdev->resource[vsec_data.rg.bar].start; dw->rg_region.paddr += vsec_data.rg.off; @@ -250,12 +253,18 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, struct dw_edma_block *dt_block = &vsec_data.dt_wr[i]; ll_region->vaddr = pcim_iomap_table(pdev)[ll_block->bar]; + if (!ll_region->vaddr) + return -ENOMEM; + ll_region->vaddr += ll_block->off; ll_region->paddr = pdev->resource[ll_block->bar].start; ll_region->paddr += ll_block->off; ll_region->sz = ll_block->sz; dt_region->vaddr = pcim_iomap_table(pdev)[dt_block->bar]; + if (!dt_region->vaddr) + return -ENOMEM; + dt_region->vaddr += dt_block->off; dt_region->paddr = pdev->resource[dt_block->bar].start; dt_region->paddr += dt_block->off; @@ -269,12 +278,18 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, struct dw_edma_block *dt_block = &vsec_data.dt_rd[i]; ll_region->vaddr = pcim_iomap_table(pdev)[ll_block->bar]; + if (!ll_region->vaddr) + return -ENOMEM; + ll_region->vaddr += ll_block->off; ll_region->paddr = pdev->resource[ll_block->bar].start; ll_region->paddr += ll_block->off; ll_region->sz = ll_block->sz; dt_region->vaddr = pcim_iomap_table(pdev)[dt_block->bar]; + if (!dt_region->vaddr) + return -ENOMEM; + dt_region->vaddr += dt_block->off; dt_region->paddr = pdev->resource[dt_block->bar].start; dt_region->paddr += dt_block->off; -- 2.7.4