ASoC: amd: acp: SoundWire machine driver fixes

Vijendar Mukunda <Vijendar.Mukunda@amd.com> says:

This series fixes four defects in the AMD ACP SoundWire machine drivers
(acp-sdw-legacy-mach.c and acp-sdw-sof-mach.c).

A bounds check is added to validate the SoundWire link ID before it is
used as an array index in create_sdw_dailink(), preventing out-of-bounds
access when an unexpected link_mask value is encountered. The codec
config count in the SOF machine driver is refactored to use a dedicated
variable rather than reusing the endpoint-count variable for two
purposes, making the intent clearer and avoiding a stale value being
passed to the codec config array. An operator-precedence bug in the
ffs(link_mask - 1) expression is corrected to ffs(link_mask) - 1,
ensuring the link ID is derived from the correct bit position. Finally,
the SOF machine driver card name is shortened to fit within the 16-byte
snd_card driver[] field and eliminate a compile-time warning.

Link: https://patch.msgid.link/20260910161728.1452808-1-Vijendar.Mukunda@amd.com
This commit is contained in:
Mark Brown 2026-09-16 20:08:20 +01:00
commit fa899ba9b1
No known key found for this signature in database
GPG key ID: 24D68B725D5487D0
2 changed files with 29 additions and 8 deletions