All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Price <steven.price@arm.com>
To: Aditya Pakki <pakki001@umn.edu>
Cc: Barry Song <baohua@kernel.org>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	kjlu@umn.edu, Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] ASoC: codecs: Fix to avoid potential NULL pointer dereferences
Date: Fri, 22 Mar 2019 16:47:54 +0000	[thread overview]
Message-ID: <23781985-7747-730c-764d-1565a511cb67@arm.com> (raw)
In-Reply-To: <20190319005805.13823-1-pakki001@umn.edu>

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@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);
> 


WARNING: multiple messages have this Message-ID (diff)
From: Steven Price <steven.price@arm.com>
To: Aditya Pakki <pakki001@umn.edu>
Cc: Barry Song <baohua@kernel.org>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	kjlu@umn.edu, Liam Girdwood <lgirdwood@gmail.com>,
	Takashi Iwai <tiwai@suse.com>, Mark Brown <broonie@kernel.org>,
	Jaroslav Kysela <perex@perex.cz>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] ASoC: codecs: Fix to avoid potential NULL pointer dereferences
Date: Fri, 22 Mar 2019 16:47:54 +0000	[thread overview]
Message-ID: <23781985-7747-730c-764d-1565a511cb67@arm.com> (raw)
In-Reply-To: <20190319005805.13823-1-pakki001@umn.edu>

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@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);
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2019-03-22 16:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-19  0:58 [PATCH] ASoC: codecs: Fix to avoid potential NULL pointer dereferences Aditya Pakki
2019-03-19  0:58 ` Aditya Pakki
2019-03-19  1:03 ` Aditya Pakki
2019-03-22 16:47 ` Steven Price [this message]
2019-03-22 16:47   ` Steven Price

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=23781985-7747-730c-764d-1565a511cb67@arm.com \
    --to=steven.price@arm.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=baohua@kernel.org \
    --cc=broonie@kernel.org \
    --cc=kjlu@umn.edu \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pakki001@umn.edu \
    --cc=perex@perex.cz \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.