lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241030170829.36161-1-surajsonawane0215@gmail.com>
Date: Wed, 30 Oct 2024 22:38:29 +0530
From: Suraj Sonawane <surajsonawane0215@...il.com>
To: Liam Girdwood <lgirdwood@...il.com>,
	Mark Brown <broonie@...nel.org>
Cc: Jaroslav Kysela <perex@...ex.cz>,
	Takashi Iwai <tiwai@...e.com>,
	linux-sound@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Suraj Sonawane <surajsonawane0215@...il.com>
Subject: [PATCH] sound: 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 occurred because the variables 'val_1' and 'val_2' are
declared but may not be assigned a value before they are used.
Specifically, if the loop that assigns values to 'val_1' and 'val_2'
does not execute (for example, when 'offlevel' is zero), these
variables remain uninitialized, leading to potential undefined
behavior.

To resolve this issue, initialize 'val_1' and 'val_2' to 0 at the
point of declaration. This ensures that 'val_1' and 'val_2' have
defined values before they are used in subsequent calculations,
preventing any warnings or undefined behavior in cases where the
loop does not run.

Signed-off-by: Suraj Sonawane <surajsonawane0215@...il.com>
---
 sound/soc/bcm/bcm63xx-pcm-whistler.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/bcm/bcm63xx-pcm-whistler.c b/sound/soc/bcm/bcm63xx-pcm-whistler.c
index 018f2372e..5c23c228e 100644
--- a/sound/soc/bcm/bcm63xx-pcm-whistler.c
+++ b/sound/soc/bcm/bcm63xx-pcm-whistler.c
@@ -232,7 +232,7 @@ static int bcm63xx_pcm_close(struct snd_soc_component *component,
 
 static irqreturn_t i2s_dma_isr(int irq, void *bcm_i2s_priv)
 {
-	unsigned int availdepth, ifflevel, offlevel, int_status, val_1, val_2;
+	unsigned int availdepth, ifflevel, offlevel, int_status, val_1 = 0, val_2 = 0;
 	struct bcm63xx_runtime_data *prtd;
 	struct snd_pcm_substream *substream;
 	struct snd_pcm_runtime *runtime;
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ