ALSA: hda - Fix the max length of control name in generic parser
authorTakashi Iwai <tiwai@suse.de>
Fri, 28 Jun 2013 09:51:32 +0000 (11:51 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 28 Jun 2013 10:13:58 +0000 (12:13 +0200)
add_control_with_pfx() in hda_generic.c assumes a shorter name string
for the control element, and this resulted in the truncation of the
long but valid string like "Headphone Surround Switch" in the middle.

This patch aligns the max size to the actual limit of snd_ctl_elem_id,
44.

Cc: <stable@vger.kernel.org> [v3.9+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_generic.c

index 1485d871d6289f00f181fbaf6e8656caefb1a965..6460fc519d360b5b62bf50cf94ae28dc8c78a6b9 100644 (file)
@@ -854,7 +854,7 @@ static int add_control_with_pfx(struct hda_gen_spec *spec, int type,
                                const char *pfx, const char *dir,
                                const char *sfx, int cidx, unsigned long val)
 {
-       char name[32];
+       char name[44];
        snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
        if (!add_control(spec, type, name, cidx, val))
                return -ENOMEM;