qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 06/11] dump: Fix writing of ELF section
Date: Mon,  6 Apr 2020 11:12:00 +0100	[thread overview]
Message-ID: <20200406101205.23027-7-peter.maydell@linaro.org> (raw)
In-Reply-To: <20200406101205.23027-1-peter.maydell@linaro.org>

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: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20200324173630.12221-1-peter.maydell@linaro.org
---
 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



  parent reply	other threads:[~2020-04-06 10:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-06 10:11 [PULL 00/11] target-arm queue Peter Maydell
2020-04-06 10:11 ` [PULL 01/11] target/arm: don't expose "ieee_half" via gdbstub Peter Maydell
2020-04-06 10:11 ` [PULL 02/11] hw/arm/collie: Put StrongARMState* into a CollieMachineState struct Peter Maydell
2020-04-06 10:11 ` [PULL 03/11] target/arm: PSTATE.PAN should not clear exec bits Peter Maydell
2020-04-06 10:11 ` [PULL 04/11] target/arm: Remove obsolete TODO note from get_phys_addr_lpae() Peter Maydell
2020-04-06 10:11 ` [PULL 05/11] hw/gpio/aspeed_gpio.c: Don't directly include assert.h Peter Maydell
2020-04-06 10:12 ` Peter Maydell [this message]
2020-04-06 10:12 ` [PULL 07/11] dma/xlnx-zdma: Remove comment Peter Maydell
2020-04-06 10:12 ` [PULL 08/11] dma/xlnx-zdma: Populate DBG0.CMN_BUF_FREE Peter Maydell
2020-04-06 10:12 ` [PULL 09/11] dma/xlnx-zdma: Clear DMA_DONE when halting Peter Maydell
2020-04-06 10:12 ` [PULL 10/11] dma/xlnx-zdma: Advance the descriptor address when stopping Peter Maydell
2020-04-06 10:12 ` [PULL 11/11] dma/xlnx-zdma: Reorg to fix CUR_DSCR Peter Maydell
2020-04-06 12:52 ` [PULL 00/11] target-arm queue Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200406101205.23027-7-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).