From: Shailendra Verma <shailendra.v@samsung.com>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>,
Paul Gortmaker <paul.gortmaker@windriver.com>,
Nicolas Ferre <nicolas.ferre@atmel.com>,
LABBE Corentin <clabbe.montjoie@gmail.com>,
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] Memory - Fix possible NULL derefrence.
Date: Mon, 30 Jan 2017 10:30:05 +0530 [thread overview]
Message-ID: <1485752405-29885-1-git-send-email-shailendra.v@samsung.com> (raw)
In-Reply-To: CGME20170130050046epcas2p381ef5bb7c8a1df4b8c7e37a93e168630@epcas2p3.samsung.com
of_device_get_match_data could return NULL, and so can cause
a NULL pointer dereference later.
Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
---
drivers/memory/atmel-sdramc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/memory/atmel-sdramc.c b/drivers/memory/atmel-sdramc.c
index 12080b0..cb63fbe 100644
--- a/drivers/memory/atmel-sdramc.c
+++ b/drivers/memory/atmel-sdramc.c
@@ -57,6 +57,10 @@ static int atmel_ramc_probe(struct platform_device *pdev)
struct clk *clk;
caps = of_device_get_match_data(&pdev->dev);
+ if (!caps) {
+ dev_err(&pdev->dev, "no device match found\n");
+ return -ENODEV;
+ }
if (caps->has_ddrck) {
clk = devm_clk_get(&pdev->dev, "ddrck");
--
1.7.9.5
next parent reply other threads:[~2017-01-30 5:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170130050046epcas2p381ef5bb7c8a1df4b8c7e37a93e168630@epcas2p3.samsung.com>
2017-01-30 5:00 ` Shailendra Verma [this message]
2017-01-30 7:59 ` [PATCH] Memory - Fix possible NULL derefrence Alexandre Belloni
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=1485752405-29885-1-git-send-email-shailendra.v@samsung.com \
--to=shailendra.v@samsung.com \
--cc=alexandre.belloni@free-electrons.com \
--cc=ashish.kalra@samsung.com \
--cc=clabbe.montjoie@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nicolas.ferre@atmel.com \
--cc=p.shailesh@samsung.com \
--cc=paul.gortmaker@windriver.com \
--cc=shailendra.capricorn@gmail.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).