[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210430084001.GA12388@lpieralisi>
Date: Fri, 30 Apr 2021 09:40:01 +0100
From: Lorenzo Pieralisi <lorenzo.pieralisi@....com>
To: Colin King <colin.king@...onical.com>
Cc: Ryder Lee <ryder.lee@...iatek.com>,
Jianjun Wang <jianjun.wang@...iatek.com>,
Rob Herring <robh@...nel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Matthias Brugger <matthias.bgg@...il.com>,
linux-pci@...r.kernel.org, linux-mediatek@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org,
kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH][next] PCI: mediatek-gen3: Add missing null pointer check
On Thu, Apr 29, 2021 at 12:00:40PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@...onical.com>
>
> The call to platform_get_resource_byname can potentially return null, so
> add a null pointer check to avoid a null pointer dereference issue.
>
> Addresses-Coverity: ("Dereference null return")
> Fixes: 441903d9e8f0 ("PCI: mediatek-gen3: Add MediaTek Gen3 driver for MT8192")
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> ---
> drivers/pci/controller/pcie-mediatek-gen3.c | 2 ++
> 1 file changed, 2 insertions(+)
Squashed into the commit it is fixing, in my pci/mediatek branch.
Thanks,
Lorenzo
> diff --git a/drivers/pci/controller/pcie-mediatek-gen3.c b/drivers/pci/controller/pcie-mediatek-gen3.c
> index 20165e4a75b2..3c5b97716d40 100644
> --- a/drivers/pci/controller/pcie-mediatek-gen3.c
> +++ b/drivers/pci/controller/pcie-mediatek-gen3.c
> @@ -721,6 +721,8 @@ static int mtk_pcie_parse_port(struct mtk_pcie_port *port)
> int ret;
>
> regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pcie-mac");
> + if (!regs)
> + return -EINVAL;
> port->base = devm_ioremap_resource(dev, regs);
> if (IS_ERR(port->base)) {
> dev_err(dev, "failed to map register base\n");
> --
> 2.30.2
>
Powered by blists - more mailing lists