diff options
| author | Philippe Mathieu-Daudé | 2020-05-18 17:53:05 +0200 |
|---|---|---|
| committer | Paolo Bonzini | 2020-06-10 18:10:23 +0200 |
| commit | 5579b524b0d2e4b310157c0b7985d35c24238120 (patch) | |
| tree | 21f2ffb03f49b785997be6968537d723aedecdee /include | |
| parent | disas: Let disas::read_memory() handler return EIO on error (diff) | |
| download | qemu-5579b524b0d2e4b310157c0b7985d35c24238120.tar.gz qemu-5579b524b0d2e4b310157c0b7985d35c24238120.tar.xz qemu-5579b524b0d2e4b310157c0b7985d35c24238120.zip | |
hw/elf_ops: Do not ignore write failures when loading ELF
Do not ignore the MemTxResult error type returned by
address_space_write().
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/hw/elf_ops.h | 11 |
1 files changed, 8 insertions, 3 deletions
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; + } } } |
