ALSA: control: Fix breakage of user ctl element addition
authorTakashi Iwai <tiwai@suse.de>
Thu, 12 Mar 2015 15:57:51 +0000 (16:57 +0100)
committerTakashi Iwai <tiwai@suse.de>
Fri, 13 Mar 2015 06:21:51 +0000 (07:21 +0100)
In the commit [2225e79b9b03: 'ALSA: core: reduce stack usage related
to snd_ctl_new()'], the id field of the newly added kctl is untouched,
thus all attribute like name string remain empty.  The fix is just to
add the forgotten memcpy of the id field.

Fixes: 2225e79b9b03 ('ALSA: core: reduce stack usage related to snd_ctl_new()')
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/control.c

index 54a412af32241cd5d377612633bd2cf80d0aca33..d677c27746e9896fd2181e64390f31cbd7388b2e 100644 (file)
@@ -1267,6 +1267,7 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file,
        err = snd_ctl_new(&kctl, count, access, file);
        if (err < 0)
                return err;
+       memcpy(&kctl->id, &info->id, sizeof(kctl->id));
        kctl->private_data = kzalloc(sizeof(struct user_element) + private_size,
                                     GFP_KERNEL);
        if (kctl->private_data == NULL) {