[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 24/25] hw/arm/boot: Explain why load_elf_hdr() error is ignored
From: |
Peter Maydell |
Subject: |
[PULL 24/25] hw/arm/boot: Explain why load_elf_hdr() error is ignored |
Date: |
Thu, 5 Sep 2024 14:00:59 +0100 |
From: Philippe Mathieu-Daudé <philmd@linaro.org>
If the file is not an ELF file, arm_setup_direct_kernel_boot()
falls back to try it as a uimage or an AArch64 Image file or as
last resort a bare raw binary. We can discard load_elf_hdr()
error and silently return.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20240903144154.17135-1-philmd@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/arm/boot.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index 6c895e05cbc..5301d8d318c 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -799,14 +799,18 @@ static ssize_t arm_load_elf(struct arm_boot_info *info,
uint64_t *pentry,
} elf_header;
int data_swab = 0;
bool big_endian;
- ssize_t ret = -1;
+ ssize_t ret;
Error *err = NULL;
load_elf_hdr(info->kernel_filename, &elf_header, &elf_is64, &err);
if (err) {
+ /*
+ * If the file is not an ELF file we silently return.
+ * The caller will fall back to try other formats.
+ */
error_free(err);
- return ret;
+ return -1;
}
if (elf_is64) {
--
2.34.1
- [PULL 23/25] hw/arm/boot: Report error msg if loading elf/dtb failed, (continued)
- [PULL 23/25] hw/arm/boot: Report error msg if loading elf/dtb failed, Peter Maydell, 2024/09/05
- [PULL 08/25] target/arm: Enable FEAT_EBF16 in the "max" CPU, Peter Maydell, 2024/09/05
- [PULL 02/25] target/arm: Pass env pointer through to sme_bfmopa helper, Peter Maydell, 2024/09/05
- [PULL 19/25] hm/nvram/xlnx-versal-efuse-ctrl: Call register_finalize_block, Peter Maydell, 2024/09/05
- [PULL 22/25] hw/arm/xilinx_zynq: Enable Security Extensions, Peter Maydell, 2024/09/05
- [PULL 25/25] platform-bus: fix refcount leak, Peter Maydell, 2024/09/05
- [PULL 18/25] hw/misc/xlnx-versal-trng: Call register_finalize_block, Peter Maydell, 2024/09/05
- [PULL 20/25] hw/arm/sbsa-ref: Don't leak string in sbsa_fdt_add_gic_node(), Peter Maydell, 2024/09/05
- [PULL 21/25] target/arm: Correct names of VFP VFNMA and VFNMS insns, Peter Maydell, 2024/09/05
- [PULL 15/25] hw/misc/xlnx-versal-trng: Free s->prng in finalize, not unrealize, Peter Maydell, 2024/09/05
- [PULL 24/25] hw/arm/boot: Explain why load_elf_hdr() error is ignored,
Peter Maydell <=
- Re: [PULL 00/25] target-arm queue, Peter Maydell, 2024/09/06