[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 4/7] hw/elf_ops: Do not ignore write failures when loading
From: |
Stefano Garzarella |
Subject: |
Re: [PATCH v2 4/7] hw/elf_ops: Do not ignore write failures when loading ELF |
Date: |
Tue, 19 May 2020 09:58:05 +0200 |
On Mon, May 18, 2020 at 05:53:05PM +0200, Philippe Mathieu-Daudé wrote:
> Do not ignore the MemTxResult error type returned by
> address_space_write().
>
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> include/hw/elf_ops.h | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
Reviewed-by: Stefano Garzarella <address@hidden>
>
> diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h
> index 398a4a2c85..6fdff3dced 100644
> --- a/include/hw/elf_ops.h
> +++ b/include/hw/elf_ops.h
> @@ -553,9 +553,14 @@ static int glue(load_elf, SZ)(const char *name, int fd,
> rom_add_elf_program(label, mapped_file, data, file_size,
> mem_size, addr, as);
> } else {
> - address_space_write(as ? as : &address_space_memory,
> - addr, MEMTXATTRS_UNSPECIFIED,
> - data, file_size);
> + MemTxResult res;
> +
> + res = address_space_write(as ? as :
> &address_space_memory,
> + addr, MEMTXATTRS_UNSPECIFIED,
> + data, file_size);
> + if (res != MEMTX_OK) {
> + goto fail;
> + }
> }
> }
>
> --
> 2.21.3
>
- [PATCH v2 0/7] exec/memory: Enforce checking MemTxResult values, Philippe Mathieu-Daudé, 2020/05/18
- [PATCH v2 1/7] exec: Let address_space_read/write_cached() propagate MemTxResult, Philippe Mathieu-Daudé, 2020/05/18
- [PATCH v2 2/7] exec: Propagate cpu_memory_rw_debug() error, Philippe Mathieu-Daudé, 2020/05/18
- [PATCH v2 4/7] hw/elf_ops: Do not ignore write failures when loading ELF, Philippe Mathieu-Daudé, 2020/05/18
- Re: [PATCH v2 4/7] hw/elf_ops: Do not ignore write failures when loading ELF,
Stefano Garzarella <=
- [PATCH v2 5/7] hw/arm/boot: Abort if set_kernel_args() fails, Philippe Mathieu-Daudé, 2020/05/18
- [RFC PATCH v2 6/7] accel/kvm: Let KVM_EXIT_MMIO return error, Philippe Mathieu-Daudé, 2020/05/18
- [PATCH v2 3/7] disas: Let disas::read_memory() handler return EIO on error, Philippe Mathieu-Daudé, 2020/05/18
- [RFC PATCH v2 7/7] hw/core/loader: Assert loading ROM regions succeeds at reset, Philippe Mathieu-Daudé, 2020/05/18