[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230205015733.1721009-1-trix@redhat.com>
Date: Sat, 4 Feb 2023 17:57:33 -0800
From: Tom Rix <trix@...hat.com>
To: lgirdwood@...il.com, broonie@...nel.org, perex@...ex.cz,
tiwai@...e.com, liweilei@...nic.com, colin.i.king@...il.com,
wangweidong.a@...nic.com, zhaolei@...nic.com
Cc: alsa-devel@...a-project.org, linux-kernel@...r.kernel.org,
Tom Rix <trix@...hat.com>
Subject: [PATCH] ASoC: codecs: aw88395: initialize cur_scene_id to 0
cppcheck reports
sound/soc/codecs/aw88395/aw88395_lib.c:789:6: error: Uninitialized variable: cur_scene_id [uninitvar]
if (cur_scene_id == 0) {
^
Passing a garbage value to aw_dev_parse_data_by_sec_type_v1() will cause a crash
when the value is used as an array index. This check assumes cur_scene_id is
initialized to 0, so initialize it to 0.
Fixes: 4345865b003b ("ASoC: codecs: ACF bin parsing and check library file for aw88395")
Signed-off-by: Tom Rix <trix@...hat.com>
---
sound/soc/codecs/aw88395/aw88395_lib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/aw88395/aw88395_lib.c b/sound/soc/codecs/aw88395/aw88395_lib.c
index 64dde972f3f0..d7c31a202adc 100644
--- a/sound/soc/codecs/aw88395/aw88395_lib.c
+++ b/sound/soc/codecs/aw88395/aw88395_lib.c
@@ -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;
--
2.26.3
Powered by blists - more mailing lists