Devicetree
 help / color / mirror / Atom feed
* Re: [PATCH v2 5/7] ASoC: loongson: Add Loongson-2K0300 CTCISZ Forever Pi sound card support
       [not found] <1b2fa7b37c354df6ac7b2c1c5f9f3fac2b8af3ff.1780538113.git.zhoubinbin@loongson.cn>
@ 2026-06-04  2:26 ` sashiko-bot
  0 siblings, 0 replies; only message in thread
From: sashiko-bot @ 2026-06-04  2:26 UTC (permalink / raw)
  To: Binbin Zhou; +Cc: conor+dt, devicetree, robh

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Uninitialized pointer `codec_dai_name` is used if the required device property is missing.
--

commit ca8a45881e3592679d02b8f941222c143f73d4c0
Author: Binbin Zhou <zhoubinbin@loongson.cn>

ASoC: loongson: Add Loongson-2K0300 CTCISZ Forever Pi sound card support

The Loongson-2K0300 audio card uses a different DAI format compared to
existing Loongson platforms. Move the dai_fmt setting from the static DAI
link to runtime hw_params via snd_soc_runtime_set_dai_fmt(), and pass the
correct format through driver match data.

> diff --git a/sound/soc/loongson/loongson_card.c b/sound/soc/loongson/loongson_card.c
> index 7910d5d9ac4ff..9200e8476c1fa 100644
> --- a/sound/soc/loongson/loongson_card.c
> +++ b/sound/soc/loongson/loongson_card.c

[ ... ]

[Severity: High]
This isn't a bug introduced by this patch, but while reviewing this file I
noticed a pre-existing issue in loongson_card_parse_acpi().

Is it possible for the "codec-dai-name" device property to be missing?

In loongson_card_parse_acpi(), codec_dai_name is declared without being
initialized:

	const char *codec_dai_name;
	...
	device_property_read_string(card->dev, "codec-dai-name", &codec_dai_name);

	for (i = 0; i < card->num_links; i++) {
		loongson_dai_links[i].platforms->name = dev_name(phy_dev);
		loongson_dai_links[i].codecs->name = codec_name;
		loongson_dai_links[i].codecs->dai_name = codec_dai_name;
	}

If device_property_read_string() returns an error because the property is
missing, codec_dai_name remains uninitialized garbage. This garbage pointer
is then assigned to the global loongson_dai_links[i].codecs->dai_name,
which ASoC core will dereference during component matching.

Could this lead to a kernel panic if the firmware lacks this property? Should
the return value of device_property_read_string() be checked or a default
value be provided?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1780538113.git.zhoubinbin@loongson.cn?part=5

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-04  2:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1b2fa7b37c354df6ac7b2c1c5f9f3fac2b8af3ff.1780538113.git.zhoubinbin@loongson.cn>
2026-06-04  2:26 ` [PATCH v2 5/7] ASoC: loongson: Add Loongson-2K0300 CTCISZ Forever Pi sound card support sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox