diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2017-05-13 18:39:01 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2017-06-30 02:04:10 -0400 |
commit | a9bd8dfa539493db265e46a496c1a89279ab31d1 (patch) | |
tree | 65385b633e9100ad454c5df7e15633cea9ab97b2 | |
parent | 30e7e3ecf39e578ffab6d5944c79c1d30dee0d3f (diff) |
kimage_file_prepare_segments(): don't open-code memdup_user()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | kernel/kexec_file.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index b118735fea9d..766e7e4d3ad9 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c | |||
@@ -162,16 +162,10 @@ kimage_file_prepare_segments(struct kimage *image, int kernel_fd, int initrd_fd, | |||
162 | } | 162 | } |
163 | 163 | ||
164 | if (cmdline_len) { | 164 | if (cmdline_len) { |
165 | image->cmdline_buf = kzalloc(cmdline_len, GFP_KERNEL); | 165 | image->cmdline_buf = memdup_user(cmdline_ptr, cmdline_len); |
166 | if (!image->cmdline_buf) { | 166 | if (IS_ERR(image->cmdline_buf)) { |
167 | ret = -ENOMEM; | 167 | ret = PTR_ERR(image->cmdline_buf); |
168 | goto out; | 168 | image->cmdline_buf = NULL; |
169 | } | ||
170 | |||
171 | ret = copy_from_user(image->cmdline_buf, cmdline_ptr, | ||
172 | cmdline_len); | ||
173 | if (ret) { | ||
174 | ret = -EFAULT; | ||
175 | goto out; | 169 | goto out; |
176 | } | 170 | } |
177 | 171 | ||