ALSA: control: Fix breakage of user ctl element addition
PATCH 1/1 ALSA: control: Fix breakage of user ctl element addition
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.
--- sound/core/control.c | 1 + 1 file changed, 1 insertion(+)
sound/core/control.c +1 -0
@@ -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 ) {
Signature · 1 line
2.3.2
Quoted 16 lines · Takashi Iwai
In the commit [
2225e79b9b03: 'ALSA: core: reduce stack usage related tosnd_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()')Signed-off-by Takashi Iwai <[email protected]>--- sound/core/control.c | 1 + 1 file changed, 1 insertion(+)sound/core/control.c +0
-0
sound/core/control.c static int snd_ctl_elem_add(struct snd_ctl_file *file, · line 1273
Quoted 7 lines
sound/core/control.c +1
-0@@ -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 ) {
Oops, exactly... Thanks.
I think the line can be simpler, like:
kctl->id = info->id;
But in both cases, assembler code may be the same due to compiler optimization.
Takashi Sakamoto