kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] ASoC: codecs: lpass-rx-macro: Fix uninitialized variable ec_tx
@ 2021-02-15 16:33 Colin King
  2021-02-15 20:05 ` [PATCH][next] ASoC: codecs: lpass-rx-macro: remove redundant initialization of variable hph_pwr_mode Colin King
  2021-02-23 14:10 ` [PATCH][next] ASoC: codecs: lpass-rx-macro: Fix uninitialized variable ec_tx Mark Brown
  0 siblings, 2 replies; 5+ messages in thread
From: Colin King @ 2021-02-15 16:33 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Srinivas Kandagatla, alsa-devel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

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")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 sound/soc/codecs/lpass-rx-macro.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c
index c9c21d22c2c4..8c04b3b2c907 100644
--- a/sound/soc/codecs/lpass-rx-macro.c
+++ b/sound/soc/codecs/lpass-rx-macro.c
@@ -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);
-- 
2.30.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH][next] ASoC: codecs: lpass-rx-macro: remove redundant initialization of variable hph_pwr_mode
  2021-02-15 16:33 [PATCH][next] ASoC: codecs: lpass-rx-macro: Fix uninitialized variable ec_tx Colin King
@ 2021-02-15 20:05 ` Colin King
  2021-02-17 14:14   ` Srinivas Kandagatla
  2021-03-01 23:34   ` Mark Brown
  2021-02-23 14:10 ` [PATCH][next] ASoC: codecs: lpass-rx-macro: Fix uninitialized variable ec_tx Mark Brown
  1 sibling, 2 replies; 5+ messages in thread
From: Colin King @ 2021-02-15 20:05 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Srinivas Kandagatla, alsa-devel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The variable hph_pwr_mode is being initialized with a value that is
never read and it is being updated later with a new value.  The
initialization is redundant and can be removed.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 sound/soc/codecs/lpass-rx-macro.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c
index 8c04b3b2c907..76909c50d7b9 100644
--- a/sound/soc/codecs/lpass-rx-macro.c
+++ b/sound/soc/codecs/lpass-rx-macro.c
@@ -2038,7 +2038,7 @@ static int rx_macro_load_compander_coeff(struct snd_soc_component *component,
 {
 	u16 comp_coeff_lsb_reg, comp_coeff_msb_reg;
 	int i;
-	int hph_pwr_mode = HPH_LOHIFI;
+	int hph_pwr_mode;
 
 	if (!rx->comp_enabled[comp])
 		return 0;
-- 
2.30.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH][next] ASoC: codecs: lpass-rx-macro: remove redundant initialization of variable hph_pwr_mode
  2021-02-15 20:05 ` [PATCH][next] ASoC: codecs: lpass-rx-macro: remove redundant initialization of variable hph_pwr_mode Colin King
@ 2021-02-17 14:14   ` Srinivas Kandagatla
  2021-03-01 23:34   ` Mark Brown
  1 sibling, 0 replies; 5+ messages in thread
From: Srinivas Kandagatla @ 2021-02-17 14:14 UTC (permalink / raw)
  To: Colin King, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, alsa-devel
  Cc: kernel-janitors, linux-kernel



On 15/02/2021 20:05, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable hph_pwr_mode is being initialized with a value that is
> never read and it is being updated later with a new value.  The
> initialization is redundant and can be removed.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
Thanks for the patch!

LGTM,


Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

>   sound/soc/codecs/lpass-rx-macro.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c
> index 8c04b3b2c907..76909c50d7b9 100644
> --- a/sound/soc/codecs/lpass-rx-macro.c
> +++ b/sound/soc/codecs/lpass-rx-macro.c
> @@ -2038,7 +2038,7 @@ static int rx_macro_load_compander_coeff(struct snd_soc_component *component,
>   {
>   	u16 comp_coeff_lsb_reg, comp_coeff_msb_reg;
>   	int i;
> -	int hph_pwr_mode = HPH_LOHIFI;
> +	int hph_pwr_mode;
>   
>   	if (!rx->comp_enabled[comp])
>   		return 0;
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH][next] ASoC: codecs: lpass-rx-macro: Fix uninitialized variable ec_tx
  2021-02-15 16:33 [PATCH][next] ASoC: codecs: lpass-rx-macro: Fix uninitialized variable ec_tx Colin King
  2021-02-15 20:05 ` [PATCH][next] ASoC: codecs: lpass-rx-macro: remove redundant initialization of variable hph_pwr_mode Colin King
@ 2021-02-23 14:10 ` Mark Brown
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2021-02-23 14:10 UTC (permalink / raw)
  To: Takashi Iwai, alsa-devel, Srinivas Kandagatla, Jaroslav Kysela,
	Liam Girdwood, Colin King
  Cc: kernel-janitors, linux-kernel

On Mon, 15 Feb 2021 16:33:13 +0000, Colin King wrote:
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH][next] ASoC: codecs: lpass-rx-macro: remove redundant initialization of variable hph_pwr_mode
  2021-02-15 20:05 ` [PATCH][next] ASoC: codecs: lpass-rx-macro: remove redundant initialization of variable hph_pwr_mode Colin King
  2021-02-17 14:14   ` Srinivas Kandagatla
@ 2021-03-01 23:34   ` Mark Brown
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2021-03-01 23:34 UTC (permalink / raw)
  To: Srinivas Kandagatla, Liam Girdwood, Jaroslav Kysela,
	Takashi Iwai, Colin King, alsa-devel
  Cc: linux-kernel, kernel-janitors

On Mon, 15 Feb 2021 20:05:01 +0000, Colin King wrote:
> The variable hph_pwr_mode is being initialized with a value that is
> never read and it is being updated later with a new value.  The
> initialization is redundant and can be removed.

Applied to

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

Thanks!

[1/1] ASoC: codecs: lpass-rx-macro: remove redundant initialization of variable hph_pwr_mode
      commit: 7f7d1c4fce10ca68e87165898e6232353e4be1af

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-03-02 13:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-15 16:33 [PATCH][next] ASoC: codecs: lpass-rx-macro: Fix uninitialized variable ec_tx Colin King
2021-02-15 20:05 ` [PATCH][next] ASoC: codecs: lpass-rx-macro: remove redundant initialization of variable hph_pwr_mode Colin King
2021-02-17 14:14   ` Srinivas Kandagatla
2021-03-01 23:34   ` Mark Brown
2021-02-23 14:10 ` [PATCH][next] ASoC: codecs: lpass-rx-macro: Fix uninitialized variable ec_tx Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).