summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-12-24 00:06:05 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2016-01-04 10:26:58 -0500
commit16e5c1fc36040e592128a164499bc25eb138a80f (patch)
treea080bd2eea306d5815c5a9eefb46180e2bedffb2 /lib
parent7e935c7ca1e6c398f11edac5beabfc4348e3b3a4 (diff)
downloadop-kernel-dev-16e5c1fc36040e592128a164499bc25eb138a80f.zip
op-kernel-dev-16e5c1fc36040e592128a164499bc25eb138a80f.tar.gz
convert a bunch of open-coded instances of memdup_user_nul()
A _lot_ of ->write() instances were open-coding it; some are converted to memdup_user_nul(), a lot more remain... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'lib')
-rw-r--r--lib/dynamic_debug.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index e3952e9..fe42b6e 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -657,14 +657,9 @@ static ssize_t ddebug_proc_write(struct file *file, const char __user *ubuf,
pr_warn("expected <%d bytes into control\n", USER_BUF_PAGE);
return -E2BIG;
}
- tmpbuf = kmalloc(len + 1, GFP_KERNEL);
- if (!tmpbuf)
- return -ENOMEM;
- if (copy_from_user(tmpbuf, ubuf, len)) {
- kfree(tmpbuf);
- return -EFAULT;
- }
- tmpbuf[len] = '\0';
+ tmpbuf = memdup_user_nul(ubuf, len);
+ if (IS_ERR(tmpbuf))
+ return PTR_ERR(tmpbuf);
vpr_info("read %d bytes from userspace\n", (int)len);
ret = ddebug_exec_queries(tmpbuf, NULL);
OpenPOWER on IntegriCloud