Skip to contentSkip to conversation

hw/arm/boot: fix direct kernel boot with initrd

PATCH Applied Andrew Jones 2 participants 2 messages Jun 18, 2019 – Jul 1, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/arm/boot: fix direct kernel boot with initrd

Fix the condition used to check whether the initrd fits into RAM; in some cases if an initrd was also passed on the command line we would get an error stating that it was too big to fit into RAM after the kernel. Despite the error the loader continued anyway, though, so also add an exit(1) when the initrd is actually too big.

Fixes 852dc64d665f ("hw/arm/boot: Diagnose layouts that put initrd or

DTB off the end of RAM")

---
 hw/arm/boot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/arm/boot.c +2 -1
index b2f93f6beff6..1fb24fbef27e 100644
@@ -1109,10 +1109,11 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu,
                              info->initrd_filename);
                 exit(1);
             }
-            if (info->initrd_start + initrd_size > info->ram_size) {
+            if (info->initrd_start + initrd_size > ram_end) {
                 error_report("could not load initrd '%s': "
                              "too big to fit into RAM after the kernel",
                              info->initrd_filename);
+                exit(1);
             }
         } else {
             initrd_size = 0;
Signature · 1 line
2.20.1
#1 lore raw
Quoted 8 lines · Andrew Jones

Fix the condition used to check whether the initrd fits into RAM; in some cases if an initrd was also passed on the command line we would get an error stating that it was too big to fit into RAM after the kernel. Despite the error the loader continued anyway, though, so also add an exit(1) when the initrd is actually too big.

Quoted 7 lines
Fixes 852dc64d665f ("hw/arm/boot: Diagnose layouts that put initrd or

DTB off the end of RAM")

---
 hw/arm/boot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Applied to target-arm.next, thanks.

-- PMM