From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796481966; b=r18966m4U7Xs+ENx9182kzltwQ9SDaONiGAhwAQVCyIHm0SHehcnv0HsBNGRAJsDqJ99 BSmGPIJgeLVSL/ap5voxFbcW4e9QofSYlQEzxgGalRzoPxybQuHU3gBC6s7LLkxLG5csP h7B8aZlWqD/kVsB4I8lRxFSOaQD3X7Xh2x1pzAFAjzSSVvaEF2yAhO1FpKJD+hsPhYPIo VJ1PqJpJyrnLSEkFI8hcW6eJM16tn7T1QzjwkR4HbYerPzvipgvyL7JiIUeSDV8ykQBjB 2qY6rikppaIoPHgOiaJDcFmEBb1/rloujkxh6jXd8GnOLwfeHFJS72yvIJ2Y7wZrXKw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796481966; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=Tyf70nVKj7hSpLbsl7n55q6njdMLO0pK6R0mwbBpuzw=; b=LIBKePC4z5JCdYgH5pm9D+IqKccOlo1sMntyGwOaToTEkTZAFmLZ8r/hXTqpDBDTwmjV a4LjKYh2XWgXMgdGD0Km/nCiAldUsqD+PIjcp+cvxZfJW7Kx2hVgcTnbcKIFsEIRKUarO q9IJuSXyODX1q93BhGULmntdEpqhOieh2kQI1aZVKqzDB1quw0B7rUoIPYi8kY915daZa UqQda+5ZrzwZ9QH3SyNMCBtSJW8XAvVRPUC+7bmKlMqVZjcy6w01n+AkjX+0bQ+yGzrrp dRkP9JSGsuolqyQO03r2ivY/jMu/7B+EPsEa2v9097ihoFiX22YoG2sfOc9O/zcIuig== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RVdcWP5u; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC5EB606A322 for ; Sat, 5 Dec 2026 14:46:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RVdcWP5u Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58CC91F00936; Sat, 5 Dec 2026 14:46:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796481966; bh=Tyf70nVKj7hSpLbsl7n55q6njdMLO0pK6R0mwbBpuzw=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=RVdcWP5uqyxF1c/bOgvq4kFV4wdzfFJyceEDNSPjvewJvUf+gyIcwYvbm/ASfCrEw EuXtjbhcsRygY3qQUd3x2IhmDpxUkxcawsFGJ99Fu70Gadv1ciWavbUQZQgBSzcp1m 79VJpbydmmyWgULi4JljpJbrV53Nw+QV7urIYSoq2XDlY4U/WGSNSMKkNZUDcUubCo DWioeSagEgAG33Z136Wf+Q/j7VDI1v1RHQR4nmPcexPaZkwRfF8wq4s1R3SUD8FO5W g/+q0yfp5cZmlMA6hyKjCdUD39sBCeW3sVVUfVjejpGZWwIRFVTk48CBWDb3wimkgG +ZPdc5xXF2qSw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] ALSA: hda: intel: Validate master count before creating link mask Reply-To: sashiko-reviews@lists.linux.dev To: "Sreeraj S Kurup" Cc: linux-sound@vger.kernel.org In-Reply-To: <20261205143113.2888-1-sreekuttan2156239@gmail.com> References: <20261205143113.2888-1-sreekuttan2156239@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 14:46:06 +0000 X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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 > 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 [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-manag= er-list property read") > diff --git a/sound/hda/core/intel-sdw-acpi.c b/sound/hda/core/intel-sdw-a= cpi.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 =3D GENMASK(count - 1, 0); > } else { > list =3D 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 overflo= w. Initializing list =3D 0 and computing GENMASK(count - 1, 0) after the shared checks avoids duplicating the validation and preserves the existing log levels and messages. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205143113.2888= -1-sreekuttan2156239@gmail.com?part=3D1