Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: hda - potential (but unlikely) uninitialized variable

This function is a bit unusual because it accepts negative values as
"conn_len". It's theoretically possible for both "cache_len" and
"conn_len" to be -ENOSPC and in that case we would oops trying to run
memcmp() on the uninitialized "list" pointer.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by

Dan Carpenter and committed by
Takashi Iwai
f4d77031 7d4b5e97

+2 -2
+2 -2
sound/pci/hda/hda_proc.c
··· 582 582 583 583 /* Get Cache connections info */ 584 584 cache_len = snd_hda_get_conn_list(codec, nid, &list); 585 - if (cache_len != conn_len 586 - || memcmp(list, conn, conn_len)) { 585 + if (cache_len >= 0 && (cache_len != conn_len || 586 + memcmp(list, conn, conn_len) != 0)) { 587 587 snd_iprintf(buffer, " In-driver Connection: %d\n", cache_len); 588 588 if (cache_len > 0) { 589 589 snd_iprintf(buffer, " ");