Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: Henry Martin <bsdhenrymartin@gmail.com>
Cc: <amadeuszx.slawinski@linux.intel.com>, <ethan@ethancedwards.com>,
	<jbrunet@baylibre.com>, <krzysztof.kozlowski@linaro.org>,
	<linux-sound@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<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>, <pierre-louis.bossart@linux.dev>,
	<broonie@kernel.org>, <perex@perex.cz>, <tiwai@suse.com>
Subject: Re: [PATCH v1] ASoC: Intel: avs: Add NULL check in avs_component_probe()
Date: Wed, 2 Apr 2025 15:59:41 +0200	[thread overview]
Message-ID: <95c39d93-f35f-4017-843e-e5d836f1b091@intel.com> (raw)
In-Reply-To: <20250401143222.30344-1-bsdhenrymartin@gmail.com>

On 2025-04-01 4:32 PM, Henry Martin wrote:
> devm_kasprintf() returns NULL when memory allocation fails. Currently,
> avs_component_probe() does not check for this case, which results in a
> NULL pointer dereference.
> 
> Add NULL check after devm_kasprintf() to prevent this issue.

This basically repeats the title, I'd suggest to drop this very line. In 
regard to the title, I believe:

	ASoC: Intel: avs: Fix null-ptr-deref in avs_component_probe()

is more straightforward. That's what you're doing here afterall, fixing 
stuff.

> 
> Fixes: 739c031110da ("ASoC: Intel: avs: Provide support for fallback topology")
> Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
Good catch, thanks for sending the fix, Martin. I'm rather strict when 
it comes to wording title/message but nothing more than a nitpick in 
this case.

Whether you would be willing to provide v2 or not, feel free to add my tag:

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>

> ---
>   sound/soc/intel/avs/pcm.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c
> index dac463390da1..7072bcf4e56f 100644
> --- a/sound/soc/intel/avs/pcm.c
> +++ b/sound/soc/intel/avs/pcm.c
> @@ -927,7 +927,8 @@ static int avs_component_probe(struct snd_soc_component *component)
>   		else
>   			mach->tplg_filename = devm_kasprintf(adev->dev, GFP_KERNEL,
>   							     "hda-generic-tplg.bin");
> -
> +		if (!mach->tplg_filename)
> +			return -ENOMEM;
>   		filename = kasprintf(GFP_KERNEL, "%s/%s", component->driver->topology_name_prefix,
>   				     mach->tplg_filename);
>   		if (!filename)


  parent reply	other threads:[~2025-04-02 13:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-01 14:32 [PATCH v1] ASoC: Intel: avs: Add NULL check in avs_component_probe() Henry Martin
2025-04-02 12:00 ` [PATCH] " Markus Elfring
2025-04-02 13:34   ` Ethan Carter Edwards
2025-04-02 14:42     ` Markus Elfring
2025-04-02 14:14   ` [PATCH] " Mark Brown
2025-04-02 13:59 ` Cezary Rojewski [this message]
2025-04-02 14:14   ` [PATCH v2] ASoC: Intel: avs: Fix null-ptr-deref " Henry Martin
2025-04-02 19:18     ` Markus Elfring
2025-04-02 19:56       ` Mark Brown
2025-04-07 23:48     ` 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=95c39d93-f35f-4017-843e-e5d836f1b091@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=bsdhenrymartin@gmail.com \
    --cc=ethan@ethancedwards.com \
    --cc=jbrunet@baylibre.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.dev \
    --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