Commit a9bd8dfa authored by Al Viro's avatar Al Viro

kimage_file_prepare_segments(): don't open-code memdup_user()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 30e7e3ec
...@@ -162,16 +162,10 @@ kimage_file_prepare_segments(struct kimage *image, int kernel_fd, int initrd_fd, ...@@ -162,16 +162,10 @@ kimage_file_prepare_segments(struct kimage *image, int kernel_fd, int initrd_fd,
} }
if (cmdline_len) { if (cmdline_len) {
image->cmdline_buf = kzalloc(cmdline_len, GFP_KERNEL); image->cmdline_buf = memdup_user(cmdline_ptr, cmdline_len);
if (!image->cmdline_buf) { if (IS_ERR(image->cmdline_buf)) {
ret = -ENOMEM; ret = PTR_ERR(image->cmdline_buf);
goto out; image->cmdline_buf = NULL;
}
ret = copy_from_user(image->cmdline_buf, cmdline_ptr,
cmdline_len);
if (ret) {
ret = -EFAULT;
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment