* [bug report] ASoC: meson: axg-card: fix null pointer dereference in clean up
@ 2019-06-18 11:07 Dan Carpenter
2019-06-19 6:58 ` Jerome Brunet
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2019-06-18 11:07 UTC (permalink / raw)
To: jbrunet; +Cc: alsa-devel
Hello Jerome Brunet,
The patch 960f428ca0a0: "ASoC: meson: axg-card: fix null pointer
dereference in clean up" from Jun 10, 2019, leads to the following
static checker warning:
sound/soc/meson/axg-card.c:121 axg_card_clean_references()
warn: address of 'link->codecs[j]' is non-NULL
sound/soc/meson/axg-card.c
109 static void axg_card_clean_references(struct axg_card *priv)
110 {
111 struct snd_soc_card *card = &priv->card;
112 struct snd_soc_dai_link *link;
113 struct snd_soc_dai_link_component *codec;
114 int i, j;
115
116 if (card->dai_link) {
117 for_each_card_prelinks(card, i, link) {
118 if (link->cpus)
119 of_node_put(link->cpus->of_node);
120 for_each_link_codecs(link, j, codec)
121 if (codec)
^^^^^
"codec" is the list iterator so it can't possibly be NULL.
122 of_node_put(codec->of_node);
123 }
124 }
125
126 if (card->aux_dev) {
127 for (i = 0; i < card->num_aux_devs; i++)
128 of_node_put(card->aux_dev[i].codec_of_node);
129 }
130
131 kfree(card->dai_link);
132 kfree(priv->link_data);
133 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [bug report] ASoC: meson: axg-card: fix null pointer dereference in clean up
2019-06-18 11:07 [bug report] ASoC: meson: axg-card: fix null pointer dereference in clean up Dan Carpenter
@ 2019-06-19 6:58 ` Jerome Brunet
0 siblings, 0 replies; 2+ messages in thread
From: Jerome Brunet @ 2019-06-19 6:58 UTC (permalink / raw)
To: Dan Carpenter; +Cc: alsa-devel
On Tue, 2019-06-18 at 14:07 +0300, Dan Carpenter wrote:
> Hello Jerome Brunet,
>
> The patch 960f428ca0a0: "ASoC: meson: axg-card: fix null pointer
> dereference in clean up" from Jun 10, 2019, leads to the following
> static checker warning:
>
> sound/soc/meson/axg-card.c:121 axg_card_clean_references()
> warn: address of 'link->codecs[j]' is non-NULL
>
> sound/soc/meson/axg-card.c
> 109 static void axg_card_clean_references(struct axg_card *priv)
> 110 {
> 111 struct snd_soc_card *card = &priv->card;
> 112 struct snd_soc_dai_link *link;
> 113 struct snd_soc_dai_link_component *codec;
> 114 int i, j;
> 115
> 116 if (card->dai_link) {
> 117 for_each_card_prelinks(card, i, link) {
> 118 if (link->cpus)
> 119 of_node_put(link->cpus->of_node);
> 120 for_each_link_codecs(link, j, codec)
> 121 if (codec)
> ^^^^^
> "codec" is the list iterator so it can't possibly be NULL.
Indeed, only "cpus" need a check.
Thanks for reporting this Dan
I'll post a fixup soon
>
> 122 of_node_put(codec->of_node);
> 123 }
> 124 }
> 125
> 126 if (card->aux_dev) {
> 127 for (i = 0; i < card->num_aux_devs; i++)
> 128 of_node_put(card->aux_dev[i].codec_of_node);
> 129 }
> 130
> 131 kfree(card->dai_link);
> 132 kfree(priv->link_data);
> 133 }
>
> regards,
> dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-19 6:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-18 11:07 [bug report] ASoC: meson: axg-card: fix null pointer dereference in clean up Dan Carpenter
2019-06-19 6:58 ` Jerome Brunet
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.