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:
0b884d2
)
ima_write_policy(): don't open-code memdup_user_nul()
author
Al Viro
<viro@zeniv.linux.org.uk>
Sat, 13 May 2017 22:15:25 +0000
(18:15 -0400)
committer
Al Viro
<viro@zeniv.linux.org.uk>
Fri, 30 Jun 2017 06:04:07 +0000
(
02:04
-0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
security/integrity/ima/ima_fs.c
patch
|
blob
|
history
diff --git
a/security/integrity/ima/ima_fs.c
b/security/integrity/ima/ima_fs.c
index
ca303e5
..
ad491c5
100644
(file)
--- a/
security/integrity/ima/ima_fs.c
+++ b/
security/integrity/ima/ima_fs.c
@@
-323,16
+323,11
@@
static ssize_t ima_write_policy(struct file *file, const char __user *buf,
if (*ppos != 0)
goto out;
-
result = -ENOMEM
;
- data = kmalloc(datalen + 1, GFP_KERNEL);
- if (!data)
+
data = memdup_user_nul(buf, datalen)
;
+ if (IS_ERR(data)) {
+ result = PTR_ERR(data);
goto out;
-
- *(data + datalen) = '\0';
-
- result = -EFAULT;
- if (copy_from_user(data, buf, datalen))
- goto out_free;
+ }
result = mutex_lock_interruptible(&ima_write_mutex);
if (result < 0)