summaryrefslogtreecommitdiff
path: root/hw/nvram
diff options
context:
space:
mode:
authorGabriel L. Somlo <somlo@cmu.edu>2015-04-29 11:21:51 -0400
committerGerd Hoffmann <kraxel@redhat.com>2015-06-10 08:00:37 +0200
commit0f9b214139d11ef058fa0f1c11c89e94fa6ef95d (patch)
tree9b62f00ef7c5795ab407f8e241b547f39050ee2c /hw/nvram
parent023e3148567ac898c7258138f8e86c3c2bb40d07 (diff)
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/nvram')
-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;