Commit 93fd2be6 authored by Yang Yingliang's avatar Yang Yingliang Committed by Mark Brown

ASoC: SOF: ipc3-dtrace: Switch to memdup_user_nul() helper

Use memdup_user_nul() helper instead of open-coding to
simplify the code.
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20230725120247.509422-1-yangyingliang@huawei.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent f957172b
...@@ -196,15 +196,9 @@ static ssize_t dfsentry_trace_filter_write(struct file *file, const char __user ...@@ -196,15 +196,9 @@ static ssize_t dfsentry_trace_filter_write(struct file *file, const char __user
return -EINVAL; return -EINVAL;
} }
string = kmalloc(count + 1, GFP_KERNEL); string = memdup_user_nul(from, count);
if (!string) if (IS_ERR(string))
return -ENOMEM; return PTR_ERR(string);
if (copy_from_user(string, from, count)) {
ret = -EFAULT;
goto error;
}
string[count] = '\0';
ret = trace_filter_parse(sdev, string, &num_elems, &elems); ret = trace_filter_parse(sdev, string, &num_elems, &elems);
if (ret < 0) if (ret < 0)
......
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