[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [rfc 1/3] arm : raise an error if the kernel size will over
From: |
Daniel Lezcano |
Subject: |
[Qemu-devel] [rfc 1/3] arm : raise an error if the kernel size will overlap the initrd |
Date: |
Mon, 6 Sep 2010 16:12:51 +0200 |
If the kernel size is too big, it overwrite the initrd image in memory
without detecting the problem. Let't detect this error and exit gracefully.
Signed-off-by: Daniel Lezcano <address@hidden>
---
hw/arm_boot.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/hw/arm_boot.c b/hw/arm_boot.c
index 620550b..50ec717 100644
--- a/hw/arm_boot.c
+++ b/hw/arm_boot.c
@@ -247,6 +247,13 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info
*info)
info->entry = entry;
if (is_linux) {
if (info->initrd_filename) {
+
+ if (KERNEL_LOAD_ADDR + kernel_size >= INITRD_LOAD_ADDR) {
+ fprintf(stderr, "qemu: kernel is too big: %d Bytes\n",
+ kernel_size);
+ exit(1);
+ }
+
initrd_size = load_image_targphys(info->initrd_filename,
info->loader_start
+ INITRD_LOAD_ADDR,
--
1.7.0.4