All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: codecs: Fix to avoid potential NULL pointer dereferences
@ 2019-03-19  0:58 ` Aditya Pakki
  0 siblings, 0 replies; 5+ messages in thread
From: Aditya Pakki @ 2019-03-19  0:58 UTC (permalink / raw)
  To: pakki001
  Cc: kjlu, Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Barry Song, alsa-devel, linux-arm-kernel, linux-kernel

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] ASoC: codecs: Fix to avoid potential NULL pointer dereferences
@ 2019-03-19  0:58 ` Aditya Pakki
  0 siblings, 0 replies; 5+ messages in thread
From: Aditya Pakki @ 2019-03-19  0:58 UTC (permalink / raw)
  To: pakki001
  Cc: Barry Song, alsa-devel, linux-kernel, kjlu, Takashi Iwai,
	Liam Girdwood, Mark Brown, Jaroslav Kysela, linux-arm-kernel

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


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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] ASoC: codecs: Fix to avoid potential NULL pointer dereferences
  2019-03-19  0:58 ` Aditya Pakki
  (?)
@ 2019-03-19  1:03 ` Aditya Pakki
  -1 siblings, 0 replies; 5+ messages in thread
From: Aditya Pakki @ 2019-03-19  1:03 UTC (permalink / raw)
  To: Aditya Pakki
  Cc: Barry Song, alsa-devel, linux-kernel, Kangjie Lu, Takashi Iwai,
	Liam Girdwood, Mark Brown, linux-arm-kernel

Apologies for the incorrect patch.
"match" is dead code and I will send a correct patch again.




On Mon, Mar 18, 2019 at 7:58 PM Aditya Pakki <pakki001@umn.edu> 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.
>
> 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
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ASoC: codecs: Fix to avoid potential NULL pointer dereferences
  2019-03-19  0:58 ` Aditya Pakki
@ 2019-03-22 16:47   ` Steven Price
  -1 siblings, 0 replies; 5+ messages in thread
From: Steven Price @ 2019-03-22 16:47 UTC (permalink / raw)
  To: Aditya Pakki
  Cc: Barry Song, alsa-devel, linux-kernel, kjlu, Takashi Iwai,
	Liam Girdwood, Mark Brown, Jaroslav Kysela, linux-arm-kernel

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ASoC: codecs: Fix to avoid potential NULL pointer dereferences
@ 2019-03-22 16:47   ` Steven Price
  0 siblings, 0 replies; 5+ messages in thread
From: Steven Price @ 2019-03-22 16:47 UTC (permalink / raw)
  To: Aditya Pakki
  Cc: Barry Song, alsa-devel, linux-kernel, kjlu, Liam Girdwood,
	Takashi Iwai, Mark Brown, Jaroslav Kysela, linux-arm-kernel

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-03-22 16:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2019-03-22 16:47   ` Steven Price

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.