[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 06/11] dump: Fix writing of ELF section
From: |
Peter Maydell |
Subject: |
[PULL 06/11] dump: Fix writing of ELF section |
Date: |
Mon, 6 Apr 2020 11:12:00 +0100 |
In write_elf_section() we set the 'shdr' pointer to point to local
structures shdr32 or shdr64, which we fill in to be written out to
the ELF dump. Unfortunately the address we pass to fd_write_vmcore()
has a spurious '&' operator, so instead of writing out the section
header we write out the literal pointer value followed by whatever is
on the stack after the 'shdr' local variable.
Pass the correct address into fd_write_vmcore().
Spotted by Coverity: CID 1421970.
Cc: address@hidden
Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-id: address@hidden
---
dump/dump.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dump/dump.c b/dump/dump.c
index 6fb6e1245ad..22ed1d3b0d4 100644
--- a/dump/dump.c
+++ b/dump/dump.c
@@ -364,7 +364,7 @@ static void write_elf_section(DumpState *s, int type, Error
**errp)
shdr = &shdr64;
}
- ret = fd_write_vmcore(&shdr, shdr_size, s);
+ ret = fd_write_vmcore(shdr, shdr_size, s);
if (ret < 0) {
error_setg_errno(errp, -ret,
"dump: failed to write section header table");
--
2.20.1
- [PULL 00/11] target-arm queue, Peter Maydell, 2020/04/06
- [PULL 02/11] hw/arm/collie: Put StrongARMState* into a CollieMachineState struct, Peter Maydell, 2020/04/06
- [PULL 03/11] target/arm: PSTATE.PAN should not clear exec bits, Peter Maydell, 2020/04/06
- [PULL 04/11] target/arm: Remove obsolete TODO note from get_phys_addr_lpae(), Peter Maydell, 2020/04/06
- [PULL 05/11] hw/gpio/aspeed_gpio.c: Don't directly include assert.h, Peter Maydell, 2020/04/06
- [PULL 06/11] dump: Fix writing of ELF section,
Peter Maydell <=
- [PULL 08/11] dma/xlnx-zdma: Populate DBG0.CMN_BUF_FREE, Peter Maydell, 2020/04/06
- [PULL 09/11] dma/xlnx-zdma: Clear DMA_DONE when halting, Peter Maydell, 2020/04/06
- [PULL 01/11] target/arm: don't expose "ieee_half" via gdbstub, Peter Maydell, 2020/04/06
- [PULL 07/11] dma/xlnx-zdma: Remove comment, Peter Maydell, 2020/04/06
- [PULL 11/11] dma/xlnx-zdma: Reorg to fix CUR_DSCR, Peter Maydell, 2020/04/06
- [PULL 10/11] dma/xlnx-zdma: Advance the descriptor address when stopping, Peter Maydell, 2020/04/06
- Re: [PULL 00/11] target-arm queue, Peter Maydell, 2020/04/06