From: "Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>
To: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Takashi Iwai <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH] ASoC: topology: Add missing memory checks
Date: Fri, 27 Mar 2020 19:16:54 +0100 [thread overview]
Message-ID: <26f6c297-7e9e-e49c-a417-796a9ccd9b07@linux.intel.com> (raw)
In-Reply-To: <4634e6654473722fca5f509ffb535535c4f6fbac.camel@linux.intel.com>
On 3/21/2020 1:18 AM, Ranjani Sridharan wrote:
(...)
>> if (pcm->compress)
>> @@ -1835,11 +1849,7 @@ static int soc_tplg_dai_create(struct soc_tplg
>> *tplg,
>> ret = soc_tplg_dai_load(tplg, dai_drv, pcm, NULL);
>> if (ret < 0) {
>> dev_err(tplg->comp->dev, "ASoC: DAI loading failed\n");
>> - kfree(dai_drv->playback.stream_name);
>> - kfree(dai_drv->capture.stream_name);
>> - kfree(dai_drv->name);
>> - kfree(dai_drv);
>> - return ret;
>> + goto err;
>> }
>>
>> dai_drv->dobj.index = tplg->index;
>> @@ -1857,9 +1867,17 @@ static int soc_tplg_dai_create(struct soc_tplg
>> *tplg,
>> if (ret != 0) {
>> dev_err(dai->dev, "Failed to create DAI widgets %d\n",
>> ret);
>> snd_soc_unregister_dai(dai);
>> - return ret;
>> + goto err;
> Hi Amadeusz,
>
> I think this is not needed. Once the dai_drv is added to the dobj_list,
> upon a failure here, the tplg components will be removed and this will
> be taken care of. So it is safe to just return ret here.
Hi,
you are right will do in v2.
(...)
>>
>> if (d->capture) {
>> stream = &dai_drv->capture;
>> caps = &d->caps[SND_SOC_TPLG_STREAM_CAPTURE];
>> - set_stream_info(stream, caps);
>> + ret = set_stream_info(stream, caps);
>> + if (ret < 0)
>> + goto err;
>> }
>>
>> if (d->flag_mask)
>> @@ -2454,10 +2485,16 @@ static int soc_tplg_dai_config(struct
>> soc_tplg *tplg,
> The return value of soc_tplg_dai_config() in soc_tplg_dai_elems_load()
> is never checked. So maybe we need a follow-up patch to fix that too?
>
Yes, actually there is few more functions where status is not checked,
will add checks for them too.
Amadeusz
prev parent reply other threads:[~2020-03-27 18:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-20 18:13 [PATCH] ASoC: topology: Add missing memory checks Amadeusz Sławiński
2020-03-21 0:18 ` Ranjani Sridharan
2020-03-27 18:16 ` Amadeusz Sławiński [this message]
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=26f6c297-7e9e-e49c-a417-796a9ccd9b07@linux.intel.com \
--to=amadeuszx.slawinski@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=ranjani.sridharan@linux.intel.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox