mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: codecs: aw88395: initialize cur_scene_id to 0
@ 2023-02-05  1:57 Tom Rix
  2023-02-06 14:36 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Rix @ 2023-02-05  1:57 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, liweilei, colin.i.king,
	wangweidong.a, zhaolei
  Cc: alsa-devel, linux-kernel, Tom Rix

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@redhat.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


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

* Re: [PATCH] ASoC: codecs: aw88395: initialize cur_scene_id to 0
  2023-02-05  1:57 [PATCH] ASoC: codecs: aw88395: initialize cur_scene_id to 0 Tom Rix
@ 2023-02-06 14:36 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2023-02-06 14:36 UTC (permalink / raw)
  To: lgirdwood, perex, tiwai, liweilei, colin.i.king, wangweidong.a,
	zhaolei, Tom Rix
  Cc: alsa-devel, linux-kernel

On Sat, 04 Feb 2023 17:57:33 -0800, Tom Rix wrote:
> 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.
> 
> [...]

Applied to

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

Thanks!

[1/1] ASoC: codecs: aw88395: initialize cur_scene_id to 0
      commit: 983272a2a223de59dbb4cb189aa4d02d7156d209

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] 2+ messages in thread

end of thread, other threads:[~2023-02-06 14:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-05  1:57 [PATCH] ASoC: codecs: aw88395: initialize cur_scene_id to 0 Tom Rix
2023-02-06 14:36 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®