diff options
author | Arnd Bergmann <arnd@arndb.de> | 2017-03-23 16:15:55 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-10-08 10:11:22 +0200 |
commit | 0cd9a4647a23243db0d1c45ebd4df4242006b8f6 (patch) | |
tree | 393cc99b82a8ecd353c727e5ffc04c702bc64e55 /sound/pci/au88x0 | |
parent | e288325e93fbb5163b26f198fd450f9d7b17938f (diff) | |
download | linux-stable-0cd9a4647a23243db0d1c45ebd4df4242006b8f6.tar.gz linux-stable-0cd9a4647a23243db0d1c45ebd4df4242006b8f6.tar.bz2 linux-stable-0cd9a4647a23243db0d1c45ebd4df4242006b8f6.zip |
ALSA: au88x0: avoid theoretical uninitialized access
commit 13f99ebdd602ebdafb909e15ec6ffb1e34690167 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound/pci/au88x0')
-rw-r--r-- | sound/pci/au88x0/au88x0_core.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/pci/au88x0/au88x0_core.c b/sound/pci/au88x0/au88x0_core.c index 72002382a0db..53713278d19d 100644 --- a/sound/pci/au88x0/au88x0_core.c +++ b/sound/pci/au88x0/au88x0_core.c @@ -2273,6 +2273,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] = |