[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 14/16] hw/arm/nseries: Check return value from load_image_targphys
From: |
Peter Maydell |
Subject: |
[PULL 14/16] hw/arm/nseries: Check return value from load_image_targphys() |
Date: |
Tue, 10 Nov 2020 11:19:15 +0000 |
The nseries machines have a codepath that allows them to load a
secondary bootloader. This code wasn't checking that the
load_image_targphys() succeeded. Check the return value and report
the error to the user.
While we're in the vicinity, fix the comment style of the
comment documenting what this image load is doing.
Fixes: Coverity CID 1192904
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20201103114918.11807-1-peter.maydell@linaro.org
---
hw/arm/nseries.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c
index 6215c18d627..387eea4d44c 100644
--- a/hw/arm/nseries.c
+++ b/hw/arm/nseries.c
@@ -1369,7 +1369,8 @@ static void n8x0_init(MachineState *machine,
/* No, wait, better start at the ROM. */
s->mpu->cpu->env.regs[15] = OMAP2_Q2_BASE + 0x400000;
- /* This is intended for loading the `secondary.bin' program from
+ /*
+ * This is intended for loading the `secondary.bin' program from
* Nokia images (the NOLO bootloader). The entry point seems
* to be at OMAP2_Q2_BASE + 0x400000.
*
@@ -1377,9 +1378,15 @@ static void n8x0_init(MachineState *machine,
* for them the entry point needs to be set to OMAP2_SRAM_BASE.
*
* The code above is for loading the `zImage' file from Nokia
- * images. */
- load_image_targphys(option_rom[0].name, OMAP2_Q2_BASE + 0x400000,
- machine->ram_size - 0x400000);
+ * images.
+ */
+ if (load_image_targphys(option_rom[0].name,
+ OMAP2_Q2_BASE + 0x400000,
+ machine->ram_size - 0x400000) < 0) {
+ error_report("Failed to load secondary bootloader %s",
+ option_rom[0].name);
+ exit(EXIT_FAILURE);
+ }
n800_setup_nolo_tags(nolo_tags);
cpu_physical_memory_write(OMAP2_SRAM_BASE, nolo_tags, 0x10000);
--
2.20.1
- [PULL 04/16] target/arm: Don't use '#' flag of printf format, (continued)
- [PULL 04/16] target/arm: Don't use '#' flag of printf format, Peter Maydell, 2020/11/10
- [PULL 03/16] target/arm: add spaces around operator, Peter Maydell, 2020/11/10
- [PULL 02/16] ssi: Fix bad printf format specifiers, Peter Maydell, 2020/11/10
- [PULL 05/16] target/arm: add space before the open parenthesis '(', Peter Maydell, 2020/11/10
- [PULL 06/16] docs: add some notes on the sbsa-ref machine, Peter Maydell, 2020/11/10
- [PULL 07/16] hw/arm/virt: Remove dependency on Cortex-A15 MPCore peripherals, Peter Maydell, 2020/11/10
- [PULL 08/16] target/arm: Fix neon VTBL/VTBX for len > 1, Peter Maydell, 2020/11/10
- [PULL 10/16] hw/misc/stm32f2xx_syscfg: Remove extraneous IRQ, Peter Maydell, 2020/11/10
- [PULL 11/16] hw/arm/nseries: Remove invalid/unnecessary n8x0_uart_setup(), Peter Maydell, 2020/11/10
- [PULL 09/16] hw/arm/armsse: Correct expansion MPC interrupt lines, Peter Maydell, 2020/11/10
- [PULL 14/16] hw/arm/nseries: Check return value from load_image_targphys(),
Peter Maydell <=
- [PULL 13/16] hw/arm/musicpal: Only use qdev_get_gpio_in() when necessary, Peter Maydell, 2020/11/10
- [PULL 12/16] hw/arm/musicpal: Don't connect two qemu_irqs directly to the same input, Peter Maydell, 2020/11/10
- [PULL 15/16] tests/qtest/npcm7xx_rng-test: count runs properly, Peter Maydell, 2020/11/10
- [PULL 16/16] target/arm/translate-neon.c: Handle VTBL UNDEF case before VFP access check, Peter Maydell, 2020/11/10
- Re: [PULL 00/16] target-arm queue, Peter Maydell, 2020/11/10