[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190319002630.12485-1-pakki001@umn.edu>
Date: Mon, 18 Mar 2019 19:26:30 -0500
From: Aditya Pakki <pakki001@....edu>
To: pakki001@....edu
Cc: kjlu@....edu, Will Deacon <will.deacon@....com>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Bjorn Helgaas <bhelgaas@...gle.com>, linux-pci@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH] PCI: Fix to avoid potential NULL pointer dereference
In gen_pci_probe, of_match_node can return a NULL pointer in case of
failure. The patch avoids a NULL pointer dereference in such a scenario.
Signed-off-by: Aditya Pakki <pakki001@....edu>
---
drivers/pci/controller/pci-host-generic.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pci/controller/pci-host-generic.c b/drivers/pci/controller/pci-host-generic.c
index dea3ec7592a2..85f473f50e96 100644
--- a/drivers/pci/controller/pci-host-generic.c
+++ b/drivers/pci/controller/pci-host-generic.c
@@ -83,6 +83,8 @@ static int gen_pci_probe(struct platform_device *pdev)
struct pci_ecam_ops *ops;
of_id = of_match_node(gen_pci_of_match, pdev->dev.of_node);
+ if (!of_id)
+ return -ENXIO;
ops = (struct pci_ecam_ops *)of_id->data;
return pci_host_common_probe(pdev, ops);
--
2.17.1
Powered by blists - more mailing lists