projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2ea659a
)
sel_write_validatetrans(): don't open-code memdup_user_nul()
author
Al Viro
<viro@zeniv.linux.org.uk>
Sat, 13 May 2017 22:12:07 +0000
(18:12 -0400)
committer
Al Viro
<viro@zeniv.linux.org.uk>
Fri, 26 May 2017 03:28:36 +0000
(23:28 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
security/selinux/selinuxfs.c
patch
|
blob
|
history
diff --git
a/security/selinux/selinuxfs.c
b/security/selinux/selinuxfs.c
index 50062e70140dcd2c80f88a0be2d1663b0f0c6d86..0940892de84de7bc94cd85a0afae6f246d54a015 100644
(file)
--- a/
security/selinux/selinuxfs.c
+++ b/
security/selinux/selinuxfs.c
@@
-656,14
+656,12
@@
static ssize_t sel_write_validatetrans(struct file *file,
if (*ppos != 0)
goto out;
- rc = -ENOMEM;
- req = kzalloc(count + 1, GFP_KERNEL);
- if (!req)
- goto out;
-
- rc = -EFAULT;
- if (copy_from_user(req, buf, count))
+ req = memdup_user_nul(buf, count);
+ if (IS_ERR(req)) {
+ rc = PTR_ERR(req);
+ req = NULL;
goto out;
+ }
rc = -ENOMEM;
oldcon = kzalloc(count + 1, GFP_KERNEL);