From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Gabriel L. Somlo" <somlo@cmu.edu>,
Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
Alexander Graf <agraf@suse.de>, Blue Swirl <blauwirbel@gmail.com>,
"open list:New World" <qemu-ppc@nongnu.org>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL v3 3/8] fw_cfg: fix FW_CFG_BOOT_DEVICE update on ppc and sparc
Date: Wed, 10 Jun 2015 08:35:26 +0200 [thread overview]
Message-ID: <1433918131-6850-4-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1433918131-6850-1-git-send-email-kraxel@redhat.com>
From: "Gabriel L. Somlo" <somlo@cmu.edu>
On ppc, sparc, and sparc64, the value of the FW_CFG_BOOT_DEVICE 16bit
fw_cfg entry is repeatedly modified from a series of callbacks, which
currently results in the previous value's dynamically allocated memory
being leaked.
This patch switches updating to the new fw_cfg_modify_i16() call, which
does not cause memory leaks.
Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/ppc/mac_newworld.c | 2 +-
hw/ppc/mac_oldworld.c | 2 +-
hw/sparc/sun4m.c | 2 +-
hw/sparc64/sun4u.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index a365bf9..0f3e341 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -119,7 +119,7 @@ static const MemoryRegionOps unin_ops = {
static void fw_cfg_boot_set(void *opaque, const char *boot_device,
Error **errp)
{
- fw_cfg_add_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]);
+ fw_cfg_modify_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]);
}
static uint64_t translate_kernel_address(void *opaque, uint64_t addr)
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index f26133d..99879dd 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -52,7 +52,7 @@
static void fw_cfg_boot_set(void *opaque, const char *boot_device,
Error **errp)
{
- fw_cfg_add_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]);
+ fw_cfg_modify_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]);
}
static uint64_t translate_kernel_address(void *opaque, uint64_t addr)
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index 8a3599c..68ac4d8 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -124,7 +124,7 @@ void DMA_register_channel (int nchan,
static void fw_cfg_boot_set(void *opaque, const char *boot_device,
Error **errp)
{
- fw_cfg_add_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]);
+ fw_cfg_modify_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]);
}
static void nvram_init(Nvram *nvram, uint8_t *macaddr,
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index 6f34e87..30cfa0e 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -127,7 +127,7 @@ void DMA_register_channel (int nchan,
static void fw_cfg_boot_set(void *opaque, const char *boot_device,
Error **errp)
{
- fw_cfg_add_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]);
+ fw_cfg_modify_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]);
}
static int sun4u_NVRAM_set_params(Nvram *nvram, uint16_t NVRAM_size,
--
1.8.3.1
next prev parent reply other threads:[~2015-06-10 6:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-10 6:35 [Qemu-devel] [PULL v3 0/8] fw_cfg patch queue Gerd Hoffmann
2015-06-10 6:35 ` [Qemu-devel] [PULL v3 1/8] QemuOpts: increase number of vm_config_groups Gerd Hoffmann
2015-06-10 6:35 ` [Qemu-devel] [PULL v3 2/8] fw_cfg: add fw_cfg_modify_i16 (update) method Gerd Hoffmann
2015-06-10 6:35 ` Gerd Hoffmann [this message]
2015-06-10 6:35 ` [Qemu-devel] [PULL v3 4/8] fw_cfg: remove support for guest-side data writes Gerd Hoffmann
2015-06-10 6:35 ` [Qemu-devel] [PULL v3 5/8] fw_cfg: prevent selector key conflict Gerd Hoffmann
2015-06-10 6:35 ` [Qemu-devel] [PULL v3 6/8] fw_cfg: prohibit insertion of duplicate fw_cfg file names Gerd Hoffmann
2015-06-10 6:35 ` [Qemu-devel] [PULL v3 7/8] fw_cfg: insert fw_cfg file blobs via qemu cmdline Gerd Hoffmann
2015-06-10 6:35 ` [Qemu-devel] [PULL v3 8/8] bios-tables-test: handle false-positive smbios signature matches Gerd Hoffmann
2015-06-10 17:13 ` [Qemu-devel] [PULL v3 0/8] fw_cfg patch 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=1433918131-6850-4-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=agraf@suse.de \
--cc=blauwirbel@gmail.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=somlo@cmu.edu \
/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).