Skip to contentSkip to conversation

ASoC: codecs: lpass-rx-macro: Fix uninitialized variable ec_tx

PATCH In review Colin King 2 participants 2 messages Feb 15, 2021 – Feb 23, 2021

Subsystems (4)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 ASoC: codecs: lpass-rx-macro: Fix uninitialized variable ec_tx

From: Colin Ian King <[email protected]>

There is potential read of the uninitialized variable ec_tx if the call to snd_soc_component_read fails or returns an unrecognized w->name. To avoid this corner case, initialize ec_tx to -1 so that it is caught later when ec_tx is bounds checked.

Addresses-Coverity: ("Uninitialized scalar variable")

Fixes 4f692926f562 ("ASoC: codecs: lpass-rx-macro: add dapm widgets and route")
---
 sound/soc/codecs/lpass-rx-macro.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/lpass-rx-macro.c +1 -1
index c9c21d22c2c4..8c04b3b2c907 100644
@@ -2895,7 +2895,7 @@ static int rx_macro_enable_echo(struct snd_soc_dapm_widget *w,
 {
 	struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
 	u16 val, ec_hq_reg;
-	int ec_tx;
+	int ec_tx = -1;
 
 	val = snd_soc_component_read(component,
 			CDC_RX_INP_MUX_RX_MIX_CFG4);
Signature · 1 line
2.30.0
maintainer
#1 lore raw
Quoted 4 lines · Colin King

There is potential read of the uninitialized variable ec_tx if the call to snd_soc_component_read fails or returns an unrecognized w->name. To avoid this corner case, initialize ec_tx to -1 so that it is caught later when ec_tx is bounds checked.

Applied to

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

Thanks!

[1/1] ASoC: codecs: lpass-rx-macro: Fix uninitialized variable ec_tx

      commit: 2d003ec15396cc8ffa2a887605c98a967de3078d

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