]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ALSA: hda - potential (but unlikely) uninitialized variable
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 17 Apr 2015 13:19:46 +0000 (16:19 +0300)
committerTakashi Iwai <tiwai@suse.de>
Fri, 17 Apr 2015 13:32:17 +0000 (15:32 +0200)
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>
sound/pci/hda/hda_proc.c

index ee6230767c641dfc67d7cc86ae2999e0fabf180c..baaf7ed068755f1fca23c1c8d39c6cd0e646ff35 100644 (file)
@@ -582,8 +582,8 @@ static void print_conn_list(struct snd_info_buffer *buffer,
 
        /* Get Cache connections info */
        cache_len = snd_hda_get_conn_list(codec, nid, &list);
-       if (cache_len != conn_len
-                       || memcmp(list, conn, conn_len)) {
+       if (cache_len >= 0 && (cache_len != conn_len ||
+                             memcmp(list, conn, conn_len) != 0)) {
                snd_iprintf(buffer, "  In-driver Connection: %d\n", cache_len);
                if (cache_len > 0) {
                        snd_iprintf(buffer, "    ");