From: Shailendra Verma <shailendra.v@samsung.com>
To: Krzysztof Kozlowski <krzk@kernel.org>,
Sangbeom Kim <sbkim73@samsung.com>,
Sylwester Nawrocki <s.nawrocki@samsung.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>,
alsa-devel@alsa-project.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] Sound: soc: samsung - Fix possible NULL derefrence.
Date: Mon, 30 Jan 2017 10:34:19 +0530 [thread overview]
Message-ID: <1485752659-30185-1-git-send-email-shailendra.v@samsung.com> (raw)
In-Reply-To: CGME20170130050433epcas3p158c643fc3cba0b3b616dc24a50e11bc0@epcas3p1.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>
---
sound/soc/samsung/i2s.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 7825bff..b5acce2 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -1224,8 +1224,13 @@ static int samsung_i2s_probe(struct platform_device *pdev)
const struct samsung_i2s_dai_data *i2s_dai_data;
int ret;
- if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node)
+ if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) {
i2s_dai_data = of_device_get_match_data(&pdev->dev);
+ if (!i2s_dai_data) {
+ dev_err(&pdev->dev, "no device match found\n");
+ return -ENODEV;
+ }
+ }
else
i2s_dai_data = (struct samsung_i2s_dai_data *)
platform_get_device_id(pdev)->driver_data;
--
1.7.9.5
next parent reply other threads:[~2017-01-30 5:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170130050433epcas3p158c643fc3cba0b3b616dc24a50e11bc0@epcas3p1.samsung.com>
2017-01-30 5:04 ` Shailendra Verma [this message]
2017-01-30 13:34 ` [alsa-devel] [PATCH] Sound: soc: samsung - Fix possible NULL derefrence Sylwester Nawrocki
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=1485752659-30185-1-git-send-email-shailendra.v@samsung.com \
--to=shailendra.v@samsung.com \
--cc=alsa-devel@alsa-project.org \
--cc=ashish.kalra@samsung.com \
--cc=broonie@kernel.org \
--cc=krzk@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=p.shailesh@samsung.com \
--cc=perex@perex.cz \
--cc=s.nawrocki@samsung.com \
--cc=sbkim73@samsung.com \
--cc=shailendra.capricorn@gmail.com \
--cc=tiwai@suse.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).