lkml.org 
[lkml]   [2019]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] ASoC: codecs: Fix to avoid potential NULL pointer dereferences
Date
In sirf_audio_codec_driver_probe, of_match_node may fail and return a
NULL pointer. The patch avoids a potential NULL pointer dereference.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
sound/soc/codecs/sirf-audio-codec.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/sound/soc/codecs/sirf-audio-codec.c b/sound/soc/codecs/sirf-audio-codec.c
index e424499a8450..fd2bbd6a3c58 100644
--- a/sound/soc/codecs/sirf-audio-codec.c
+++ b/sound/soc/codecs/sirf-audio-codec.c
@@ -464,6 +464,8 @@ static int sirf_audio_codec_driver_probe(struct platform_device *pdev)
const struct of_device_id *match;

match = of_match_node(sirf_audio_codec_of_match, pdev->dev.of_node);
+ if (!match)
+ return -ENXIO;

sirf_audio_codec = devm_kzalloc(&pdev->dev,
sizeof(struct sirf_audio_codec), GFP_KERNEL);
--
2.17.1
\
 
 \ /
  Last update: 2019-03-19 01:59    [W:0.309 / U:0.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site