linux-next/sound/soc/bcm
Suraj Sonawane 28f7aa0c01
ASoC: bcm63xx-pcm-whistler: fix uninit-value in i2s_dma_isr
Fix an issue detected by the Smatch tool:

sound/soc/bcm/bcm63xx-pcm-whistler.c:264 i2s_dma_isr()
error: uninitialized symbol 'val_1'.
sound/soc/bcm/bcm63xx-pcm-whistler.c:264 i2s_dma_isr()
error: uninitialized symbol 'val_2'.

These errors were triggered because the variables 'val_1' and 'val_2'
could remain uninitialized if 'offlevel' is zero, meaning the loop
that assigns values to them does not execute. In this case,
'dma_addr_next' would use uninitialized data, potentially leading
to undefined behavior.

To resolve this, a conditional update for 'dma_addr_next' is added,
ensuring it is assigned only when 'val_1' and 'val_2' are read.
A new boolean variable 'val_read' flags when the values have been
retrieved, setting 'dma_addr_next' only if valid data is available.

This solution prevents the use of uninitialized data, maintaining
defined behavior for 'dma_addr_next' in all cases, and aligns with
expected usage of I2S RX descriptor data.

Signed-off-by: Suraj Sonawane <surajsonawane0215@gmail.com>
Link: https://patch.msgid.link/20241102123630.25446-1-surajsonawane0215@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-11-05 12:53:28 +00:00
..
bcm63xx-i2s-whistler.c ASoC: Switch back to struct platform_driver::remove() 2024-09-09 18:26:49 +01:00
bcm63xx-i2s.h ASoC: bcm: Use platform_get_irq() to get the interrupt 2021-12-21 18:05:43 +00:00
bcm63xx-pcm-whistler.c ASoC: bcm63xx-pcm-whistler: fix uninit-value in i2s_dma_isr 2024-11-05 12:53:28 +00:00
bcm2835-i2s.c ASoC: bcm2835-i2s: Use maple tree register cache 2024-09-30 01:10:59 +02:00
cygnus-pcm.c ASoC: constify snd_soc_component_driver struct 2024-09-30 01:10:48 +02:00
cygnus-ssp.c ASoC: Switch back to struct platform_driver::remove() 2024-09-09 18:26:49 +01:00
cygnus-ssp.h ASoC: cygnus: Remove unused declarations 2023-08-13 18:16:53 +01:00
Kconfig ASoC: brcm: Add DSL/PON SoC audio driver 2020-03-13 16:01:35 +00:00
Makefile ASoC: bcm: Use *-y instead of *-objs in Makefile 2024-05-08 11:39:16 +09:00