[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <23781985-7747-730c-764d-1565a511cb67@arm.com>
Date: Fri, 22 Mar 2019 16:47:54 +0000
From: Steven Price <steven.price@....com>
To: Aditya Pakki <pakki001@....edu>
Cc: Barry Song <baohua@...nel.org>, alsa-devel@...a-project.org,
linux-kernel@...r.kernel.org, kjlu@....edu,
Takashi Iwai <tiwai@...e.com>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH] ASoC: codecs: Fix to avoid potential NULL pointer
dereferences
On 19/03/2019 00:58, Aditya Pakki wrote:
> In sirf_audio_codec_driver_probe, of_match_node may fail and return a
> NULL pointer. The patch avoids a potential NULL pointer dereference.
Actually 'match' isn't used in this function... So there's no chance of
a NULL dereference. You might as well remove the call.
Steve
> Signed-off-by: Aditya Pakki <pakki001@....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);
>
Powered by blists - more mailing lists