From 40af11eb7f80aac6c45d75e4fa6fa71ff930c651 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Tue, 6 Nov 2018 11:32:14 +0000 Subject: [PATCH] milkymist: Check for failure trying to load BIOS image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Check the return value from load_image_targphys(), which tells us whether our attempt to load the BIOS image into RAM failed. (Spotted by Coverity, CID 1190305.) Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Acked-by: Michael Walle Message-id: 20181030170032.1844-1-peter.maydell@linaro.org --- hw/lm32/milkymist.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/lm32/milkymist.c b/hw/lm32/milkymist.c index 321f184595..63c6894c95 100644 --- a/hw/lm32/milkymist.c +++ b/hw/lm32/milkymist.c @@ -138,7 +138,10 @@ milkymist_init(MachineState *machine) bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (bios_filename) { - load_image_targphys(bios_filename, BIOS_OFFSET, BIOS_SIZE); + if (load_image_targphys(bios_filename, BIOS_OFFSET, BIOS_SIZE) < 0) { + error_report("could not load bios '%s'", bios_filename); + exit(1); + } } reset_info->bootstrap_pc = BIOS_OFFSET;