[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/7] [s390] fix error handling on kernel and initrd
From: |
Christian Borntraeger |
Subject: |
[Qemu-devel] [PATCH 2/7] [s390] fix error handling on kernel and initrd failures |
Date: |
Mon, 23 Apr 2012 11:52:20 +0200 |
If the user specifies a non-existing or non-accessable kernel or initrd
qemu does not fail, instead it ipls into the system, which then falls
into a program check loop due to the zeroed memory with no kernel.
Lets add some sanity checks.
Signed-off-by: Christian Borntraeger <address@hidden>
---
hw/s390-virtio.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/hw/s390-virtio.c b/hw/s390-virtio.c
index c79784c..d17602f 100644
--- a/hw/s390-virtio.c
+++ b/hw/s390-virtio.c
@@ -230,6 +230,11 @@ static void s390_init(ram_addr_t my_ram_size,
if (kernel_size == -1UL) {
kernel_size = load_image_targphys(kernel_filename, 0, ram_size);
}
+ if (kernel_size == -1UL) {
+ fprintf(stderr, "qemu: could not load kernel '%s'\n",
+ kernel_filename);
+ exit(1);
+ }
/*
* we can not rely on the ELF entry point, since up to 3.2 this
* value was 0x800 (the SALIPL loader) and it wont work. For
@@ -269,6 +274,12 @@ static void s390_init(ram_addr_t my_ram_size,
}
initrd_size = load_image_targphys(initrd_filename, initrd_offset,
ram_size - initrd_offset);
+ if (initrd_size == -1UL) {
+ fprintf(stderr, "qemu: could not load initrd '%s'\n",
+ initrd_filename);
+ exit(1);
+ }
+
/* we have to overwrite values in the kernel image, which are "rom" */
memcpy(rom_ptr(INITRD_PARM_START), &initrd_offset, 8);
memcpy(rom_ptr(INITRD_PARM_SIZE), &initrd_size, 8);
--
1.7.9.6
- [Qemu-devel] [PATCH 0/7] Fixes for s390, Christian Borntraeger, 2012/04/23
- [Qemu-devel] [PATCH 2/7] [s390] fix error handling on kernel and initrd failures,
Christian Borntraeger <=
- [Qemu-devel] [PATCH 5/7] [s390] support reboot for kvm on s390, Christian Borntraeger, 2012/04/23
- [Qemu-devel] [PATCH 6/7] [s390] remove default cdrom, sd-card and floppy support, Christian Borntraeger, 2012/04/23
- [Qemu-devel] [PATCH 1/7] [s390] fix kernel_commandline handling, Christian Borntraeger, 2012/04/23
- [Qemu-devel] [PATCH 3/7] [s390] reboot: reset device pages on reboot, Christian Borntraeger, 2012/04/23
- [Qemu-devel] [PATCH 7/7] [s390] dont call system_shutdown on disabled wait, Christian Borntraeger, 2012/04/23
- [Qemu-devel] [PATCH 4/7] [s390] reset avail and used index on reboot, Christian Borntraeger, 2012/04/23