projects
/
GitHub
/
moto-9609
/
android_kernel_motorola_exynos9610.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
02412e9
)
xfrm_user_policy(): don't open-code memdup_user()
author
Al Viro
<viro@zeniv.linux.org.uk>
Sat, 13 May 2017 22:16:28 +0000
(18:16 -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>
net/xfrm/xfrm_state.c
patch
|
blob
|
blame
|
history
diff --git
a/net/xfrm/xfrm_state.c
b/net/xfrm/xfrm_state.c
index fc3c5aa387543a63bf18955e60309207bf06e961..5780cdad2260cb82ae268dd1a7ad972302e0d64a 100644
(file)
--- a/
net/xfrm/xfrm_state.c
+++ b/
net/xfrm/xfrm_state.c
@@
-2023,13
+2023,9
@@
int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen
if (optlen <= 0 || optlen > PAGE_SIZE)
return -EMSGSIZE;
- data = kmalloc(optlen, GFP_KERNEL);
- if (!data)
- return -ENOMEM;
-
- err = -EFAULT;
- if (copy_from_user(data, optval, optlen))
- goto out;
+ data = memdup_user(optval, optlen);
+ if (IS_ERR(data))
+ return PTR_ERR(data);
err = -EINVAL;
rcu_read_lock();
@@
-2047,7
+2043,6
@@
int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen
err = 0;
}
-out:
kfree(data);
return err;
}