This prints a message and exits if the e500 BIOS firmware can't
be found, to avoid dereferencing a null pointer.

Signed-off-by: Nia Alarie <nia.ala...@gmail.com>
---
 hw/ppc/e500.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index a40d3ec3e3..6ce03d6ff4 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -1005,6 +1005,10 @@ void ppce500_init(MachineState *machine, PPCE500Params 
*params)
         }
     }
     filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
+    if (!filename) {
+        error_report("Could not find firmware '%s'", bios_name);
+        exit(1);
+    }
 
     bios_size = load_elf(filename, NULL, NULL, &bios_entry, &loadaddr, NULL,
                          1, PPC_ELF_MACHINE, 0, 0);
-- 
2.16.2


Reply via email to