Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1607596

[PATCH] ALSA: au88x0: avoid theoretical uninitialized access

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject [PATCH] ALSA: au88x0: avoid theoretical uninitialized access
Date Thu, 23 Mar 2017 16:20:02 +0100
Message-ID <tocGS-3Wl-3@gated-at.bofh.it> (permalink)
X-Original-To Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>
X-Mailer git-send-email 2.9.0
X-Provags-ID V03:K0:CfHL7hq88FmzMgW63fmj/9pz/SULvGqz8QS9AXtIzeC5a6OV3kc SmtxEfzAtVetKI1jBvfmyaJFY/m9lGl9P79kVj3RDt9l0P8yJtzbdMI5Rz1CrB0Xyx7ndEw ipl3wtqE5/mVswMUn5TUHao4lvySbmPU0i99w9XgBQAFn9oUFipm05EyOlXhhttPegNIe5S SBnF0lYtAKusGatKlzsew==
X-Ui-Out-Filterresults notjunk:1;V01:K0:zfVyA6DYVBk=:xi+G9sLdYv2UtGxGVHqp4S /EGoKgwcUPA8bkidWoMEkgKBEftzZFowoiojlrcc1C1J3tIFiJTCHgehACeu0eJfjH+qRTP/B K0TDn+/pn8jxnlRZH+Tjhi0xVWLevF7kBzetkdX9e1r9dzXL7RMShud5hYj0TnaBskS1G3hCg 9BI2ipVKHxRL6CButIQbbcQcF4gZoxODAnPG5deHRtg5Xknl1RrE8AhQyIdxphe0Fp+5Tl+bC 4Eg8mSlenAU6NrzQm3jl2//koCcIc0krm3QzRleeGi5gU8GEgS+1Sl4I5nHEHdBOPU4H2rQUj v6dzGwyTYb3kgrE8Vpxy/sFZXl+YBh7inNCLkXZb+ViuEIxB1H7eNwH6PIjC4kL/NTYxEN1HH XZAup/ynXRro6OUKBakhyc8hngVWyfwXabYcAd4KPuF2HX0T+bWxiE2yRLgFm7xMbmb+1Gpnf IIyCKsfUBJWdVy8ogtF6mPVuN6wJOVWCsx/b8/BkOGZ/UnJ/t2pcmksu/kUAl6Jpc/ItyjO/H cFaxKmHtNwgPh9qZQ90VElzwFfE3nmddGxrTDI4MxEd4uCM2t7fhvzHrwXT2fhpv59A0aj6Oc ACFi+heI7qi61Dw8YuZKBWmp4h1JKGnZfb+OQ1Bi7pfhRG+GK1r9Wqco2au7PLEgPqJf10dnw we9YYsY6HPtS9xGDfRsIi2tas+9Bz8dhx/rOT3RYmPdCg728qvwbV//U60LWzHivOHzI=
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 32
Organization linux.* mail to news gateway
X-Original-Cc Arnd Bergmann <arnd@arndb.de>, Colin Ian King <colin.king@canonical.com>, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
X-Original-Date Thu, 23 Mar 2017 16:15:55 +0100
X-Original-Message-ID <20170323151607.636485-1-arnd@arndb.de>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1607596

Show key headers only | View raw


The latest gcc-7.0.1 snapshot points out that we if nr_ch is zero, we never
initialize some variables:

sound/pci/au88x0/au88x0_core.c: In function 'vortex_adb_allocroute':
sound/pci/au88x0/au88x0_core.c:2304:68: error: 'mix[0]' may be used uninitialized in this function [-Werror=maybe-uninitialized]
sound/pci/au88x0/au88x0_core.c:2305:58: error: 'src[0]' may be used uninitialized in this function [-Werror=maybe-uninitialized]

I assume this can never happen in practice, but adding a check here doesn't
hurt either and avoids the warning. The code has been unchanged since
the start of git history.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 sound/pci/au88x0/au88x0_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/pci/au88x0/au88x0_core.c b/sound/pci/au88x0/au88x0_core.c
index e1af24f87566..c308a4f70550 100644
--- a/sound/pci/au88x0/au88x0_core.c
+++ b/sound/pci/au88x0/au88x0_core.c
@@ -2279,6 +2279,9 @@ vortex_adb_allocroute(vortex_t *vortex, int dma, int nr_ch, int dir,
 	} else {
 		int src[2], mix[2];
 
+		if (nr_ch < 1)
+			return -EINVAL;
+
 		/* Get SRC and MIXER hardware resources. */
 		for (i = 0; i < nr_ch; i++) {
 			if ((mix[i] =
-- 
2.9.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] ALSA: au88x0: avoid theoretical uninitialized access Arnd Bergmann <arnd@arndb.de> - 2017-03-23 16:20 +0100
  Re: [PATCH] ALSA: au88x0: avoid theoretical uninitialized access Takashi Iwai <tiwai@suse.de> - 2017-03-24 12:10 +0100

csiph-web