OSDN Git Service

hw/riscv/boot.c: exit early if filename is NULL in load functions
authorDaniel Henrique Barboza <dbarboza@ventanamicro.com>
Mon, 2 Jan 2023 11:52:34 +0000 (08:52 -0300)
committerAlistair Francis <alistair.francis@wdc.com>
Fri, 20 Jan 2023 00:14:13 +0000 (10:14 +1000)
commit1db0c57adeb981c9581f7729e8e8dfb60bdb4e7c
tree14531285c20bb64979da9e50b481558baf2d3a0b
parent60c7dfa2a3d7eb3919054367c2d03d4fc1bef3f1
hw/riscv/boot.c: exit early if filename is NULL in load functions

riscv_load_firmware(), riscv_load_initrd() and riscv_load_kernel() works
under the assumption that a 'filename' parameter is always not NULL.

This is currently the case since all callers of these functions are
checking for NULL before calling them. Add an g_assert() to make sure
that a NULL value in these cases are to be considered a bug.

Suggested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20230102115241.25733-5-dbarboza@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
hw/riscv/boot.c