Skip to contentSkip to conversation

ASoC: Intel: sof_sdw: Fix unlikely uninitialized variable use in create_sdw_dailinks()

PATCH In review Bard Liao 2 participants 2 messages Mar 3, 2025 – Mar 4, 2025

Subsystems (3)
lore
Share & tools
lore

Bard Liao

author maintainer
#0 lore raw

PATCH 1/1 ASoC: Intel: sof_sdw: Fix unlikely uninitialized variable use in create_sdw_dailinks()

From: Peter Ujfalusi <[email protected]>

Initialize current_be_id to 0 to handle the unlikely case when there are no devices connected to a DAI.
In this case create_sdw_dailink() would return without touching the passed pointer to current_be_id.

Found by gcc -fanalyzer

Fixes 59bf457d8055 ("ASoC: intel: sof_sdw: Factor out SoundWire DAI creation")
---
 sound/soc/intel/boards/sof_sdw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/boards/sof_sdw.c +1 -1
index c13064c77726..90dafa810b2e 100644
@@ -954,7 +954,7 @@ static int create_sdw_dailinks(struct snd_soc_card *card,
 
 	/* generate DAI links by each sdw link */
 	while (sof_dais->initialised) {
-		int current_be_id;
+		int current_be_id = 0;
 
 		ret = create_sdw_dailink(card, sof_dais, dai_links,
 					 &current_be_id, codec_conf);
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 8 lines · Bard Liao

Initialize current_be_id to 0 to handle the unlikely case when there are no devices connected to a DAI.
In this case create_sdw_dailink() would return without touching the passed pointer to current_be_id.

Found by gcc -fanalyzer

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: Intel: sof_sdw: Fix unlikely uninitialized variable use in create_sdw_dailinks()

      commit: 4363f02a39e25e80e68039b4323c570b0848ec66

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark