summaryrefslogtreecommitdiffstats
path: root/hw/arm/orangepi.c
diff options
context:
space:
mode:
authorNiek Linnenbank2020-03-30 14:18:58 +0200
committerPeter Maydell2020-03-30 14:18:58 +0200
commitc251191eae40e0e26680d0d8a8a065735acadef8 (patch)
treebaf0ceaccf9ccc0ba31184a6d68e0247b1b9b328 /hw/arm/orangepi.c
parentMerge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-5.0-pull-re... (diff)
downloadqemu-c251191eae40e0e26680d0d8a8a065735acadef8.tar.gz
qemu-c251191eae40e0e26680d0d8a8a065735acadef8.tar.xz
qemu-c251191eae40e0e26680d0d8a8a065735acadef8.zip
hw/arm/orangepi: check for potential NULL pointer when calling blk_is_available
The Orange Pi PC initialization function needs to verify that the SD card block backend is usable before calling the Boot ROM setup routine. When calling blk_is_available() the input parameter should not be NULL. This commit ensures that blk_is_available is only called with non-NULL input. Reported-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Niek Linnenbank <nieklinnenbank@gmail.com> Message-id: 20200322205439.15231-1-nieklinnenbank@gmail.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/arm/orangepi.c')
-rw-r--r--hw/arm/orangepi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/arm/orangepi.c b/hw/arm/orangepi.c
index 181f5badab..a9f64c5680 100644
--- a/hw/arm/orangepi.c
+++ b/hw/arm/orangepi.c
@@ -104,7 +104,7 @@ static void orangepi_init(MachineState *machine)
machine->ram);
/* Load target kernel or start using BootROM */
- if (!machine->kernel_filename && blk_is_available(blk)) {
+ if (!machine->kernel_filename && blk && blk_is_available(blk)) {
/* Use Boot ROM to copy data from SD card to SRAM */
allwinner_h3_bootrom_setup(h3, blk);
}