summaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorGabriel L. Somlo2015-04-29 17:21:51 +0200
committerGerd Hoffmann2015-06-10 08:00:37 +0200
commit0f9b214139d11ef058fa0f1c11c89e94fa6ef95d (patch)
tree9b62f00ef7c5795ab407f8e241b547f39050ee2c /hw
parentfw_cfg: remove support for guest-side data writes (diff)
downloadqemu-0f9b214139d11ef058fa0f1c11c89e94fa6ef95d.tar.gz
qemu-0f9b214139d11ef058fa0f1c11c89e94fa6ef95d.tar.xz
qemu-0f9b214139d11ef058fa0f1c11c89e94fa6ef95d.zip
fw_cfg: prevent selector key conflict
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>
Diffstat (limited to 'hw')
-rw-r--r--hw/nvram/fw_cfg.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index d2a43470e0..0c0e15ecf5 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;