Commit 59aeaf3f authored by Al Viro's avatar Al Viro

snd_ctl_elem_init_enum_names(): switch to vmemdup_user()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 88a89037
...@@ -1198,7 +1198,7 @@ static int snd_ctl_elem_init_enum_names(struct user_element *ue) ...@@ -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) if (ue->info.value.enumerated.names_length > 64 * 1024)
return -EINVAL; return -EINVAL;
names = memdup_user((const void __user *)user_ptrval, names = vmemdup_user((const void __user *)user_ptrval,
ue->info.value.enumerated.names_length); ue->info.value.enumerated.names_length);
if (IS_ERR(names)) if (IS_ERR(names))
return PTR_ERR(names); return PTR_ERR(names);
...@@ -1209,7 +1209,7 @@ static int snd_ctl_elem_init_enum_names(struct user_element *ue) ...@@ -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) { for (i = 0; i < ue->info.value.enumerated.items; ++i) {
name_len = strnlen(p, buf_len); name_len = strnlen(p, buf_len);
if (name_len == 0 || name_len >= 64 || name_len == buf_len) { if (name_len == 0 || name_len >= 64 || name_len == buf_len) {
kfree(names); kvfree(names);
return -EINVAL; return -EINVAL;
} }
p += name_len + 1; p += name_len + 1;
...@@ -1227,7 +1227,7 @@ static void snd_ctl_elem_user_free(struct snd_kcontrol *kcontrol) ...@@ -1227,7 +1227,7 @@ static void snd_ctl_elem_user_free(struct snd_kcontrol *kcontrol)
struct user_element *ue = kcontrol->private_data; struct user_element *ue = kcontrol->private_data;
kvfree(ue->tlv_data); kvfree(ue->tlv_data);
kfree(ue->priv_data); kvfree(ue->priv_data);
kfree(ue); kfree(ue);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment