Skip to contentSkip to conversation

ASoC: codecs: aw88395: Uninitialized variable bug in aw_dev_parse_dev_type_v1()

PATCH In review Dan Carpenter 2 participants 2 messages Feb 6, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: codecs: aw88395: Uninitialized variable bug in aw_dev_parse_dev_type_v1()

The "cur_scene_id" variable is never initialized. It needs to be set to zero for the code to work.

Fixes 4345865b003b ("ASoC: codecs: ACF bin parsing and check library file for aw88395")

---
Presumably this code was tested with CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO=y or whatever to automatically initialize it to zero or it would have died specatularly. ;)

 sound/soc/codecs/aw88395/aw88395_lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/aw88395/aw88395_lib.c +1 -1
index 64dde972f3f0..d7c31a202adc 100644
@@ -769,7 +769,7 @@ static int aw_dev_parse_dev_type_v1(struct aw_device *aw_dev,
 {
 	struct aw_cfg_dde_v1 *cfg_dde =
 		(struct aw_cfg_dde_v1 *)((char *)prof_hdr + prof_hdr->hdr_offset);
-	int cur_scene_id;
+	int cur_scene_id = 0;
 	unsigned int i;
 	int ret;
 
Signature · 1 line
2.35.1
maintainer
#1 lore raw
Quoted 2 lines · Dan Carpenter

The "cur_scene_id" variable is never initialized. It needs to be set to zero for the code to work.

Someone already sent a fix for this.