From: "Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>
To: Chen Ni <nichen@iscas.ac.cn>,
cezary.rojewski@intel.com, pierre-louis.bossart@linux.intel.com,
liam.r.girdwood@linux.intel.com, peter.ujfalusi@linux.intel.com,
yung-chuan.liao@linux.intel.com,
ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com,
broonie@kernel.org, perex@perex.cz, tiwai@suse.com,
kuninori.morimoto.gx@renesas.com, brent.lu@intel.com
Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: hdaudio.c: Add missing check for devm_kstrdup
Date: Fri, 15 Sep 2023 11:16:57 +0200 [thread overview]
Message-ID: <1c887615-0e59-8556-e2ab-b985033519d7@linux.intel.com> (raw)
In-Reply-To: <20230915021344.3078-1-nichen@iscas.ac.cn>
On 9/15/2023 4:13 AM, Chen Ni wrote:
> Because of the potential failure of the devm_kstrdup(), the
> dl[i].codecs->name could be NULL.
> Therefore, we need to check it and return -ENOMEM in order to transfer
> the error.
>
> Fixes: 97030a43371e ("ASoC: Intel: avs: Add HDAudio machine board")
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
> ---
> sound/soc/intel/avs/boards/hdaudio.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/sound/soc/intel/avs/boards/hdaudio.c b/sound/soc/intel/avs/boards/hdaudio.c
> index cb00bc86ac94..8876558f19a1 100644
> --- a/sound/soc/intel/avs/boards/hdaudio.c
> +++ b/sound/soc/intel/avs/boards/hdaudio.c
> @@ -55,6 +55,9 @@ static int avs_create_dai_links(struct device *dev, struct hda_codec *codec, int
> return -ENOMEM;
>
> dl[i].codecs->name = devm_kstrdup(dev, cname, GFP_KERNEL);
> + if (!dl[i].codecs->name)
> + return -ENOMEM;
> +
> dl[i].codecs->dai_name = pcm->name;
> dl[i].num_codecs = 1;
> dl[i].num_cpus = 1;
Good catch
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
next prev parent reply other threads:[~2023-09-15 9:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-15 2:13 [PATCH] ASoC: hdaudio.c: Add missing check for devm_kstrdup Chen Ni
2023-09-15 9:16 ` Amadeusz Sławiński [this message]
2023-09-15 16:13 ` Mark Brown
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=1c887615-0e59-8556-e2ab-b985033519d7@linux.intel.com \
--to=amadeuszx.slawinski@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=brent.lu@intel.com \
--cc=broonie@kernel.org \
--cc=cezary.rojewski@intel.com \
--cc=kai.vehmanen@linux.intel.com \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=liam.r.girdwood@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nichen@iscas.ac.cn \
--cc=perex@perex.cz \
--cc=peter.ujfalusi@linux.intel.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=ranjani.sridharan@linux.intel.com \
--cc=tiwai@suse.com \
--cc=yung-chuan.liao@linux.intel.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