qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Gabriel L. Somlo" <somlo@cmu.edu>, Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL v2 5/8] fw_cfg: prevent selector key conflict
Date: Tue,  9 Jun 2015 14:27:32 +0200	[thread overview]
Message-ID: <1433852855-4323-6-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1433852855-4323-1-git-send-email-kraxel@redhat.com>

From: "Gabriel L. Somlo" <somlo@cmu.edu>

Enforce a single assignment of data for each distinct selector key.

Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/nvram/fw_cfg.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index d2a4347..0c0e15e 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -423,6 +423,7 @@ static void fw_cfg_add_bytes_read_callback(FWCfgState *s, uint16_t key,
     key &= FW_CFG_ENTRY_MASK;
 
     assert(key < FW_CFG_MAX_ENTRY && len < UINT32_MAX);
+    assert(s->entries[arch][key].data == NULL); /* avoid key conflict */
 
     s->entries[arch][key].data = data;
     s->entries[arch][key].len = (uint32_t)len;
-- 
1.8.3.1

  parent reply	other threads:[~2015-06-09 12:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-09 12:27 [Qemu-devel] [PULL v2 0/8] fw_cfg patch queue Gerd Hoffmann
2015-06-09 12:27 ` [Qemu-devel] [PULL v2 1/8] QemuOpts: increase number of vm_config_groups Gerd Hoffmann
2015-06-09 12:27 ` [Qemu-devel] [PULL v2 2/8] fw_cfg: add fw_cfg_modify_i16 (update) method Gerd Hoffmann
2015-06-09 12:27 ` [Qemu-devel] [PULL v2 3/8] fw_cfg: fix FW_CFG_BOOT_DEVICE update on ppc and sparc Gerd Hoffmann
2015-06-09 12:27 ` [Qemu-devel] [PULL v2 4/8] fw_cfg: remove support for guest-side data writes Gerd Hoffmann
2015-06-09 12:27 ` Gerd Hoffmann [this message]
2015-06-09 12:27 ` [Qemu-devel] [PULL v2 6/8] fw_cfg: prohibit insertion of duplicate fw_cfg file names Gerd Hoffmann
2015-06-09 12:27 ` [Qemu-devel] [PULL v2 7/8] fw_cfg: insert fw_cfg file blobs via qemu cmdline Gerd Hoffmann
2015-06-09 12:27 ` [Qemu-devel] [PULL v2 8/8] bios-tables-test: handle false-positive smbios signature matches Gerd Hoffmann
2015-06-09 13:11 ` [Qemu-devel] [PULL v2 0/8] fw_cfg patch queue Peter Maydell
2015-06-10  6:31   ` Gerd Hoffmann

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=1433852855-4323-6-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=qemu-devel@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).