summaryrefslogtreecommitdiffstats
path: root/fs/dlm/user.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-12-24 06:06:05 +0100
committerAl Viro <viro@zeniv.linux.org.uk>2016-01-04 16:26:58 +0100
commit16e5c1fc36040e592128a164499bc25eb138a80f (patch)
treea080bd2eea306d5815c5a9eefb46180e2bedffb2 /fs/dlm/user.c
parentMerge branch 'memdup_user_nul' into work.misc (diff)
downloadlinux-16e5c1fc36040e592128a164499bc25eb138a80f.tar.xz
linux-16e5c1fc36040e592128a164499bc25eb138a80f.zip
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 'fs/dlm/user.c')
-rw-r--r--fs/dlm/user.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/fs/dlm/user.c b/fs/dlm/user.c
index 173b3873a4f4..1925d6d222b8 100644
--- a/fs/dlm/user.c
+++ b/fs/dlm/user.c
@@ -515,14 +515,9 @@ static ssize_t device_write(struct file *file, const char __user *buf,
if (count > sizeof(struct dlm_write_request) + DLM_RESNAME_MAXLEN)
return -EINVAL;
- kbuf = kzalloc(count + 1, GFP_NOFS);
- if (!kbuf)
- return -ENOMEM;
-
- if (copy_from_user(kbuf, buf, count)) {
- error = -EFAULT;
- goto out_free;
- }
+ kbuf = memdup_user_nul(buf, count);
+ if (!IS_ERR(kbuf))
+ return PTR_ERR(kbuf);
if (check_version(kbuf)) {
error = -EBADE;