Skip to contentSkip to conversation

armv7m: Guard against no -kernel argument

PATCH In review Peter A. G. Crosthwaite 4 participants 4 messages Aug 10, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 armv7m: Guard against no -kernel argument

A -kernel argument must be specified for this machine. Gaurd against no -kernel argument. Previously gave an unhelpful "bad address" error message.

---
 hw/armv7m.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
hw/armv7m.c +5 -0
index 8cec78d..9f66667 100644
@@ -227,6 +227,11 @@ qemu_irq *armv7m_init(MemoryRegion *address_space_mem,
     big_endian = 0;
 #endif
 
+    if (!kernel_filename) {
+        fprintf(stderr, "Guest image must be specified (using -kernel)\n");
+        exit(1);
+    }
+
     image_size = load_elf(kernel_filename, NULL, NULL, &entry, &lowaddr,
                           NULL, big_endian, ELF_MACHINE, 1);
     if (image_size < 0) {
Signature · 1 line
1.7.0.4
#2 lore raw
In reply to Peter A. G. Crosthwaite

Am 10.08.2012 03:27, schrieb Peter A. G. Crosthwaite:

Quoted 1 line

A -kernel argument must be specified for this machine. Gaurd against no -kernel

"Guard"

Quoted 3 lines

argument. Previously gave an unhelpful "bad address" error message.

Otherwise looks good - PMM, can you fix?

/-F

Quoted 21 lines
---
 hw/armv7m.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
hw/armv7m.c +5 -0
index 8cec78d..9f66667 100644
@@ -227,6 +227,11 @@ qemu_irq *armv7m_init(MemoryRegion *address_space_mem,
     big_endian = 0;
 #endif
 
+    if (!kernel_filename) {
+        fprintf(stderr, "Guest image must be specified (using -kernel)\n");
+        exit(1);
+    }
+
     image_size = load_elf(kernel_filename, NULL, NULL, &entry, &lowaddr,
                           NULL, big_endian, ELF_MACHINE, 1);
     if (image_size < 0) {
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#3 lore raw
Quoted 10 lines · Andreas Färber

Am 10.08.2012 03:27, schrieb Peter A. G. Crosthwaite:

Quoted 1 line

A -kernel argument must be specified for this machine. Gaurd against no -kernel

"Guard"

Quoted 3 lines

argument. Previously gave an unhelpful "bad address" error message.

Otherwise looks good - PMM, can you fix?

Yes, I have fixed the typo and put this patch into arm-devs.next. I'm planning to put together a pullreq later today.

-- PMM