From: sashiko-bot@kernel.org
To: "Sreeraj S Kurup" <sreekuttan2156239@gmail.com>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH] ALSA: hda: intel: Validate master count before creating link mask
Date: Sat, 05 Dec 2026 14:46:06 +0000 [thread overview]
Message-ID: <sashiko-outbox-251650@kernel.org> (raw)
In-Reply-To: <20261205143113.2888-1-sreekuttan2156239@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] ALSA: hda: intel: missing Fixes tag for commit 71dce222d586
- [Low] ALSA: hda: duplicate count validation in
sdw_intel_scan_controller()
--
commit cfa6b3eb11ed3c7a1ef0fa0f46fa5c38d14757af
Author: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
> ALSA: hda: intel: Validate master count before creating link mask
>
> The driver uses GENMASK(count - 1, 0) to create the link
> mask from the mipi-sdw-master-count ACPI property.
>
> However, the count is checked only after GENMASK() is called.
> If firmware reports a count of zero, the unsigned subtraction
> count - 1 underflows. If the count exceeds
> SDW_INTEL_MAX_LINKS, an invalid link mask may be generated.
>
> Validate that the count is non-zero and does not exceed
> SDW_INTEL_MAX_LINKS before creating the link mask.
>
> Return -EINVAL if the count is invalid.
>
> Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
[Severity: Low]
This fixes a bug introduced when GENMASK(count - 1, 0) was added ahead of
the existing count checks. Should this include:
Fixes: 71dce222d586 ("ALSA/hda: intel-sdw-acpi: add support for sdw-manager-list property read")
> diff --git a/sound/hda/core/intel-sdw-acpi.c b/sound/hda/core/intel-sdw-acpi.c
> index d3511135f7d39..4d6bfc5e25dec 100644
> --- a/sound/hda/core/intel-sdw-acpi.c
> +++ b/sound/hda/core/intel-sdw-acpi.c
> @@ -90,6 +90,13 @@ sdw_intel_scan_controller(struct sdw_intel_acpi_info *info)
> ret);
> return ret;
> }
> +
> + /* Check count before constructing the link mask */
> + if (!count || count > SDW_INTEL_MAX_LINKS) {
> + dev_err(&adev->dev, "Invalid link count: %u\n",
> + count);
> + return -EINVAL;
> + }
> list = GENMASK(count - 1, 0);
> } else {
> list = tmp;
[Severity: Low]
Could GENMASK(count - 1, 0) be deferred past the existing count checks right
below the if/else block instead of duplicating them here?
Validating !count here with dev_err() escalates a zero mipi-sdw-master-count
from dev_warn() to an error, unlike mipi-sdw-manager-list, even though
callers like snd_intel_dsp_driver_probe() treat no SoundWire links as a
normal fallback. The new message also drops SDW_INTEL_MAX_LINKS on overflow.
Initializing list = 0 and computing GENMASK(count - 1, 0) after the shared
checks avoids duplicating the validation and preserves the existing log
levels and messages.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261205143113.2888-1-sreekuttan2156239@gmail.com?part=1
next prev parent reply other threads:[~2026-12-05 14:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-05 14:31 [PATCH] ALSA: hda: intel: Validate master count before creating link mask Sreeraj S Kurup
2026-12-05 14:46 ` sashiko-bot [this message]
2026-12-05 15:18 ` [PATCH v2] " Sreeraj S Kurup
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=sashiko-outbox-251650@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sreekuttan2156239@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.