From: sashiko-bot@kernel.org
To: "Binbin Zhou" <zhoubinbin@loongson.cn>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v2 5/7] ASoC: loongson: Add Loongson-2K0300 CTCISZ Forever Pi sound card support
Date: Thu, 04 Jun 2026 02:26:38 +0000 [thread overview]
Message-ID: <20260604022638.B07331F00893@smtp.kernel.org> (raw)
In-Reply-To: <1b2fa7b37c354df6ac7b2c1c5f9f3fac2b8af3ff.1780538113.git.zhoubinbin@loongson.cn>
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
parent reply other threads:[~2026-06-04 2:26 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <1b2fa7b37c354df6ac7b2c1c5f9f3fac2b8af3ff.1780538113.git.zhoubinbin@loongson.cn>]
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=20260604022638.B07331F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=zhoubinbin@loongson.cn \
/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