[PATCH] kexec: remove the 2GB size limit on initrd file

Robi Buranyi rburanyi at google.com
Wed Sep 2 03:34:04 EDT 2020


Enable loading initrd files exceeding the INT_MAX size. Remove the
INT_MAX limit completely, and let any initrd load if it fits in the
memory.

Signed-off-by: Robi Buranyi <rburanyi at google.com>
---
 kernel/kexec_file.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index ca40bef75a61..659a9d165198 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -222,7 +222,7 @@ kimage_file_prepare_segments(struct kimage *image, int kernel_fd, int initrd_fd,
 	loff_t size;
 
 	ret = kernel_read_file_from_fd(kernel_fd, &image->kernel_buf,
-				       &size, INT_MAX, READING_KEXEC_IMAGE);
+				       &size, 0, READING_KEXEC_IMAGE);
 	if (ret)
 		return ret;
 	image->kernel_buf_len = size;
@@ -242,7 +242,7 @@ kimage_file_prepare_segments(struct kimage *image, int kernel_fd, int initrd_fd,
 	/* It is possible that there no initramfs is being loaded */
 	if (!(flags & KEXEC_FILE_NO_INITRAMFS)) {
 		ret = kernel_read_file_from_fd(initrd_fd, &image->initrd_buf,
-					       &size, INT_MAX,
+					       &size, 0,
 					       READING_KEXEC_INITRAMFS);
 		if (ret)
 			goto out;
-- 
2.28.0.402.g5ffc5be6b7-goog




More information about the kexec mailing list