From: Shailendra Verma <shailendra.v@samsung.com>
To: Zhou Wang <wangzhou1@hisilicon.com>,
Gabriele Paoloni <gabriele.paoloni@huawei.com>,
Bjorn Helgaas <bhelgaas@google.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
p.shailesh@samsung.com, ashish.kalra@samsung.com,
Shailendra Verma <shailendra.v@samsung.com>,
Shailendra Verma <shailendra.capricorn@gmail.com>
Subject: [PATCH] Pci: host - Fix possible NULL derefrence.
Date: Mon, 30 Jan 2017 10:19:35 +0530 [thread overview]
Message-ID: <1485751775-29126-1-git-send-email-shailendra.v@samsung.com> (raw)
In-Reply-To: CGME20170130044942epcas2p4c3e879675c189ff46c27b5f35bbc350f@epcas2p4.samsung.com
of_match_device could return NULL, and so can cause a NULL
pointer dereference later.
Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
---
drivers/pci/host/pcie-hisi.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/pci/host/pcie-hisi.c b/drivers/pci/host/pcie-hisi.c
index 56154c2..3256f8f 100644
--- a/drivers/pci/host/pcie-hisi.c
+++ b/drivers/pci/host/pcie-hisi.c
@@ -174,6 +174,10 @@ static int hisi_pcie_probe(struct platform_device *pdev)
driver = dev->driver;
match = of_match_device(driver->of_match_table, dev);
+ if (!match) {
+ dev_err(dev, "Error: No device match found\n");
+ return -ENODEV;
+ }
hisi_pcie->soc_ops = (struct pcie_soc_ops *) match->data;
hisi_pcie->subctrl =
--
1.7.9.5
next parent reply other threads:[~2017-01-30 4:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170130044942epcas2p4c3e879675c189ff46c27b5f35bbc350f@epcas2p4.samsung.com>
2017-01-30 4:49 ` Shailendra Verma [this message]
2017-01-31 15:09 ` [PATCH] Pci: host - Fix possible NULL derefrence Bjorn Helgaas
2017-01-31 18:22 ` Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1485751775-29126-1-git-send-email-shailendra.v@samsung.com \
--to=shailendra.v@samsung.com \
--cc=ashish.kalra@samsung.com \
--cc=bhelgaas@google.com \
--cc=gabriele.paoloni@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=p.shailesh@samsung.com \
--cc=shailendra.capricorn@gmail.com \
--cc=wangzhou1@hisilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).