Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1569392

[PATCH] Sound: soc: samsung - Fix possible NULL derefrence.

From Shailendra Verma <shailendra.v@samsung.com>
Newsgroups linux.kernel
Subject [PATCH] Sound: soc: samsung - Fix possible NULL derefrence.
Date 2017-01-30 06:10 +0100
Message-ID <t5co1-8ip-9@gated-at.bofh.it> (permalink)
References <t5co1-8ip-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH] Sound: soc: samsung - Fix possible NULL derefrence. Shailendra Verma <shailendra.v@samsung.com> - 2017-01-30 06:10 +0100
  Re: [alsa-devel] [PATCH] Sound: soc: samsung - Fix possible NULL  derefrence. Sylwester Nawrocki <s.nawrocki@samsung.com> - 2017-01-30 14:40 +0100

csiph-web