aboutsummaryrefslogtreecommitdiff
path: root/hw/riscv/spike.c
diff options
context:
space:
mode:
authorBin Meng <bin.meng@windriver.com>2022-04-21 13:56:29 +0800
committerAlistair Francis <alistair.francis@wdc.com>2022-04-29 10:47:45 +1000
commit58303fc0be8ccd7557414a920d4c666fce36eb41 (patch)
tree900873ca93397a3faf1c3f538c050692bc532276 /hw/riscv/spike.c
parent6d3b9c024ce4e115f4dc24706d4c45bdc04ba093 (diff)
downloadqemu-58303fc0be8ccd7557414a920d4c666fce36eb41.zip
qemu-58303fc0be8ccd7557414a920d4c666fce36eb41.tar.gz
qemu-58303fc0be8ccd7557414a920d4c666fce36eb41.tar.bz2
hw/riscv: Don't add empty bootargs to device tree
Commit 7c28f4da20e5 ("RISC-V: Don't add NULL bootargs to device-tree") tried to avoid adding *NULL* bootargs to device tree, but unfortunately the changes were entirely useless, due to MachineState::kernel_cmdline can't be NULL at all as the default value is given as an empty string. (see hw/core/machine.c::machine_initfn()). Note the wording of *NULL* bootargs is wrong. It can't be NULL otherwise a segfault had already been observed by dereferencing the NULL pointer. It should be worded as *empty" bootargs. Fixes: 7c28f4da20e5 ("RISC-V: Don't add NULL bootargs to device-tree") Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <20220421055629.1177285-2-bmeng.cn@gmail.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'hw/riscv/spike.c')
-rw-r--r--hw/riscv/spike.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c
index 1562b00..068ba34 100644
--- a/hw/riscv/spike.c
+++ b/hw/riscv/spike.c
@@ -177,7 +177,7 @@ static void create_fdt(SpikeState *s, const MemMapEntry *memmap,
qemu_fdt_add_subnode(fdt, "/chosen");
qemu_fdt_setprop_string(fdt, "/chosen", "stdout-path", "/htif");
- if (cmdline) {
+ if (cmdline && *cmdline) {
qemu_fdt_setprop_string(fdt, "/chosen", "bootargs", cmdline);
}
}