Skip to content
Snippets Groups Projects
Commit c251191e authored by Niek Linnenbank's avatar Niek Linnenbank Committed by Peter Maydell
Browse files

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: default avatarPeter Maydell <peter.maydell@linaro.org>
Signed-off-by: default avatarNiek Linnenbank <nieklinnenbank@gmail.com>
Message-id: 20200322205439.15231-1-nieklinnenbank@gmail.com
Reviewed-by: default avatarPeter Maydell <peter.maydell@linaro.org>
Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parent f9fe8450
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment