linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: Fix to avoid potential NULL pointer dereference
@ 2019-03-19  0:26 Aditya Pakki
  2019-03-19  5:36 ` Jisheng Zhang
  0 siblings, 1 reply; 2+ messages in thread
From: Aditya Pakki @ 2019-03-19  0:26 UTC (permalink / raw)
  To: pakki001
  Cc: Lorenzo Pieralisi, kjlu, Will Deacon, linux-kernel, linux-pci,
	Bjorn Helgaas, linux-arm-kernel

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@umn.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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-19  5:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-19  0:26 [PATCH] PCI: Fix to avoid potential NULL pointer dereference Aditya Pakki
2019-03-19  5:36 ` Jisheng Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).