From: Jan Beulich Date: Fri, 5 Jun 2026 09:09:55 +0000 (+0200) Subject: RISC-V: riscv_set_arch() can fail X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aa04700525c30e140cdab646b72e31faa1608077;p=thirdparty%2Fbinutils-gdb.git RISC-V: riscv_set_arch() can fail In that case neither riscv_rps_as.subset_list nor file_arch_str would be set, yet the NULL pointers would be happily passed into functions not expecting such. Reviewed-by: Jiawei --- diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c index 75e5542eb9b..22d002a3309 100644 --- a/gas/config/tc-riscv.c +++ b/gas/config/tc-riscv.c @@ -345,7 +345,9 @@ riscv_set_arch (const char *s) { as_bad (_("the architecture string of -march and elf architecture " "attributes cannot be empty")); - return; + if (file_arch_str != NULL) + return; + s = DEFAULT_RISCV_ARCH_WITH_EXT; } if (riscv_rps_as.subset_list == NULL)