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 /kernel | |
parent | 30e7e3ecf39e578ffab6d5944c79c1d30dee0d3f (diff) | |
download | linux-a9bd8dfa539493db265e46a496c1a89279ab31d1.tar.bz2 |
kimage_file_prepare_segments(): don't open-code memdup_user()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel')
-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, } if (cmdline_len) { - image->cmdline_buf = kzalloc(cmdline_len, GFP_KERNEL); - if (!image->cmdline_buf) { - ret = -ENOMEM; - goto out; - } - - ret = copy_from_user(image->cmdline_buf, cmdline_ptr, - cmdline_len); - if (ret) { - ret = -EFAULT; + image->cmdline_buf = memdup_user(cmdline_ptr, cmdline_len); + if (IS_ERR(image->cmdline_buf)) { + ret = PTR_ERR(image->cmdline_buf); + image->cmdline_buf = NULL; goto out; } |