summaryrefslogtreecommitdiff
path: root/sound/pci/au88x0
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2017-03-23 16:15:55 +0100
committerTakashi Iwai <tiwai@suse.de>2017-03-24 11:59:51 +0100
commit13f99ebdd602ebdafb909e15ec6ffb1e34690167 (patch)
tree8677fa5731adc91e59e1b4b8a67422159f638e28 /sound/pci/au88x0
parenta16fbb85c78a3ce56dc4515ffb8632b82cc969c7 (diff)
ALSA: au88x0: avoid theoretical uninitialized access
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> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/au88x0')
-rw-r--r--sound/pci/au88x0/au88x0_core.c3
1 files changed, 3 insertions, 0 deletions
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] =