Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Henry Martin <bsdhenrymartin@gmail.com>, linux-sound@vger.kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>,
	"Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>,
	"Bard Liao" <yung-chuan.liao@linux.intel.com>,
	"Cezary Rojewski" <cezary.rojewski@intel.com>,
	"Ethan Carter Edwards" <ethan@ethancedwards.com>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Jerome Brunet" <jbrunet@baylibre.com>,
	"Julia Lawall" <julia.lawall@inria.fr>,
	"Kai Vehmanen" <kai.vehmanen@linux.intel.com>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski@linaro.org>,
	"Liam Girdwood" <liam.r.girdwood@linux.intel.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Peter Ujfalusi" <peter.ujfalusi@linux.intel.com>,
	"Pierre-Louis Bossart" <pierre-louis.bossart@linux.dev>,
	"Ranjani Sridharan" <ranjani.sridharan@linux.intel.com>,
	"Takashi Iwai" <tiwai@suse.com>
Subject: Re: [PATCH v2] ASoC: Intel: avs: Fix null-ptr-deref in avs_component_probe()
Date: Wed, 2 Apr 2025 21:18:27 +0200	[thread overview]
Message-ID: <4481af92-9573-4f40-ad65-a2d6b3ca2e0e@web.de> (raw)
In-Reply-To: <20250402141411.44972-1-bsdhenrymartin@gmail.com>

> devm_kasprintf() returns NULL when memory allocation fails. Currently,
…
                                                       failed?

Can a summary phrase like “Prevent null pointer dereference
in avs_component_probe()” a bit nicer?


…
> +++ 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;

Can a blank line be desirable after such a statement?


Would another source code transformation become helpful with an additional update step?

-		if (((vendor_id >> 16) & 0xFFFF) == 0x8086)
-			mach->tplg_filename = devm_kasprintf(adev->dev, GFP_KERNEL,
-							     "hda-8086-generic-tplg.bin");
-		else
-			mach->tplg_filename = devm_kasprintf(adev->dev, GFP_KERNEL,
-							     "hda-generic-tplg.bin");
+		mach->tplg_filename = devm_kasprintf(adev->dev, GFP_KERNEL,
+						     (((vendor_id >> 16) & 0xFFFF) == 0x8086)
+						     ? "hda-8086-generic-tplg.bin"
+						     : "hda-generic-tplg.bin");


Regards,
Markus

  reply	other threads:[~2025-04-02 19:18 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 ` [PATCH v1] " Cezary Rojewski
2025-04-02 14:14   ` [PATCH v2] ASoC: Intel: avs: Fix null-ptr-deref " Henry Martin
2025-04-02 19:18     ` Markus Elfring [this message]
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=4481af92-9573-4f40-ad65-a2d6b3ca2e0e@web.de \
    --to=markus.elfring@web.de \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=bsdhenrymartin@gmail.com \
    --cc=cezary.rojewski@intel.com \
    --cc=ethan@ethancedwards.com \
    --cc=jbrunet@baylibre.com \
    --cc=julia.lawall@inria.fr \
    --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