projects
/
platform
/
kernel
/
linux-rpi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f957172
)
ASoC: SOF: ipc3-dtrace: Switch to memdup_user_nul() helper
author
Yang Yingliang
<yangyingliang@huawei.com>
Tue, 25 Jul 2023 12:02:47 +0000
(20:02 +0800)
committer
Mark Brown
<broonie@kernel.org>
Mon, 7 Aug 2023 18:56:07 +0000
(19:56 +0100)
Use memdup_user_nul() helper instead of open-coding to
simplify the code.
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link:
https://lore.kernel.org/r/20230725120247.509422-1-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/ipc3-dtrace.c
patch
|
blob
|
history
diff --git
a/sound/soc/sof/ipc3-dtrace.c
b/sound/soc/sof/ipc3-dtrace.c
index 35da85a45a9aeded73a21bfcfeda4233999d144c..bd07f0472efd719b99df5cd9afd9bced1318bedc 100644
(file)
--- a/
sound/soc/sof/ipc3-dtrace.c
+++ b/
sound/soc/sof/ipc3-dtrace.c
@@
-196,15
+196,9
@@
static ssize_t dfsentry_trace_filter_write(struct file *file, const char __user
return -EINVAL;
}
- string = kmalloc(count + 1, GFP_KERNEL);
- if (!string)
- return -ENOMEM;
-
- if (copy_from_user(string, from, count)) {
- ret = -EFAULT;
- goto error;
- }
- string[count] = '\0';
+ string = memdup_user_nul(from, count);
+ if (IS_ERR(string))
+ return PTR_ERR(string);
ret = trace_filter_parse(sdev, string, &num_elems, &elems);
if (ret < 0)