snd_ctl_elem_init_enum_names(): switch to vmemdup_user()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2018-01-07 13:11:03 -05:00
parent 88a890375f
commit 59aeaf3fef
1 changed files with 3 additions and 3 deletions

View File

@ -1198,7 +1198,7 @@ static int snd_ctl_elem_init_enum_names(struct user_element *ue)
if (ue->info.value.enumerated.names_length > 64 * 1024)
return -EINVAL;
names = memdup_user((const void __user *)user_ptrval,
names = vmemdup_user((const void __user *)user_ptrval,
ue->info.value.enumerated.names_length);
if (IS_ERR(names))
return PTR_ERR(names);
@ -1209,7 +1209,7 @@ static int snd_ctl_elem_init_enum_names(struct user_element *ue)
for (i = 0; i < ue->info.value.enumerated.items; ++i) {
name_len = strnlen(p, buf_len);
if (name_len == 0 || name_len >= 64 || name_len == buf_len) {
kfree(names);
kvfree(names);
return -EINVAL;
}
p += name_len + 1;
@ -1227,7 +1227,7 @@ static void snd_ctl_elem_user_free(struct snd_kcontrol *kcontrol)
struct user_element *ue = kcontrol->private_data;
kvfree(ue->tlv_data);
kfree(ue->priv_data);
kvfree(ue->priv_data);
kfree(ue);
}