aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/boot/compressed/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/boot/compressed/misc.c')
-rw-r--r--arch/x86/boot/compressed/misc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index b3c5a5f030ce..00241c815524 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -338,7 +338,7 @@ asmlinkage __visible void *extract_kernel(void *rmode, memptr heap,
338 unsigned long output_len) 338 unsigned long output_len)
339{ 339{
340 const unsigned long kernel_total_size = VO__end - VO__text; 340 const unsigned long kernel_total_size = VO__end - VO__text;
341 unsigned long virt_addr = (unsigned long)output; 341 unsigned long virt_addr = LOAD_PHYSICAL_ADDR;
342 342
343 /* Retain x86 boot parameters pointer passed from startup_32/64. */ 343 /* Retain x86 boot parameters pointer passed from startup_32/64. */
344 boot_params = rmode; 344 boot_params = rmode;
@@ -390,6 +390,8 @@ asmlinkage __visible void *extract_kernel(void *rmode, memptr heap,
390#ifdef CONFIG_X86_64 390#ifdef CONFIG_X86_64
391 if (heap > 0x3fffffffffffUL) 391 if (heap > 0x3fffffffffffUL)
392 error("Destination address too large"); 392 error("Destination address too large");
393 if (virt_addr + max(output_len, kernel_total_size) > KERNEL_IMAGE_SIZE)
394 error("Destination virtual address is beyond the kernel mapping area");
393#else 395#else
394 if (heap > ((-__PAGE_OFFSET-(128<<20)-1) & 0x7fffffff)) 396 if (heap > ((-__PAGE_OFFSET-(128<<20)-1) & 0x7fffffff))
395 error("Destination address too large"); 397 error("Destination address too large");
@@ -397,7 +399,7 @@ asmlinkage __visible void *extract_kernel(void *rmode, memptr heap,
397#ifndef CONFIG_RELOCATABLE 399#ifndef CONFIG_RELOCATABLE
398 if ((unsigned long)output != LOAD_PHYSICAL_ADDR) 400 if ((unsigned long)output != LOAD_PHYSICAL_ADDR)
399 error("Destination address does not match LOAD_PHYSICAL_ADDR"); 401 error("Destination address does not match LOAD_PHYSICAL_ADDR");
400 if ((unsigned long)output != virt_addr) 402 if (virt_addr != LOAD_PHYSICAL_ADDR)
401 error("Destination virtual address changed when not relocatable"); 403 error("Destination virtual address changed when not relocatable");
402#endif 404#endif
403 405