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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210521194603.2077623-1-trix@redhat.com>
Date:   Fri, 21 May 2021 12:46:03 -0700
From:   trix@...hat.com
To:     perex@...ex.cz, tiwai@...e.com, gustavoars@...nel.org
Cc:     alsa-devel@...a-project.org, linux-kernel@...r.kernel.org,
        Tom Rix <trix@...hat.com>
Subject: [PATCH] ALSA: usb-audio: initialize the cur variable

From: Tom Rix <trix@...hat.com>

Static analysis reports this problem
clock.c:338:10: warning: The right operand of '=='
  is a garbage value
    if (i == cur)
          ^  ~~~

In __uac_clock_find_source() the goto find_others skips over
setting of the 'cur' variable.  Since the pin loop variable
starts with 1, it is safe to initialize cur to 0.

Signed-off-by: Tom Rix <trix@...hat.com>
---
 sound/usb/clock.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index 772478c725c2e..edc458c50bf2c 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -258,9 +258,10 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip,
 	union uac23_clock_source_desc *source;
 	union uac23_clock_selector_desc *selector;
 	union uac23_clock_multiplier_desc *multiplier;
-	int ret, i, cur, err, pins, clock_id;
+	int ret, i, err, pins, clock_id;
 	const u8 *sources;
 	int proto = fmt->protocol;
+	int cur = 0;
 
 	entity_id &= 0xff;
 
-- 
2.26.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ