ALSA: hda - using uninitialized data
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 26 Nov 2014 22:34:43 +0000 (01:34 +0300)
committerTakashi Iwai <tiwai@suse.de>
Thu, 27 Nov 2014 08:34:41 +0000 (09:34 +0100)
In olden times the snd_hda_param_read() function always set "*start_id"
but in 2007 we introduced a new return and it causes uninitialized data
bugs in a couple of the callers: print_codec_info() and
hdmi_parse_codec().

Fixes: e8a7f136f5ed ('[ALSA] hda-intel - Improve HD-audio codec probing robustness')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_codec.c

index b2d58998dbddbb6c99e0b93c2a9b390565c8f0a6..2fe86d2e1b09dfc6f5d8f095a3fc3ad4792680f5 100644 (file)
@@ -346,8 +346,10 @@ int snd_hda_get_sub_nodes(struct hda_codec *codec, hda_nid_t nid,
        unsigned int parm;
 
        parm = snd_hda_param_read(codec, nid, AC_PAR_NODE_COUNT);
-       if (parm == -1)
+       if (parm == -1) {
+               *start_id = 0;
                return 0;
+       }
        *start_id = (parm >> 16) & 0x7fff;
        return (int)(parm & 0x7fff);
 }