From 0f9b214139d11ef058fa0f1c11c89e94fa6ef95d Mon Sep 17 00:00:00 2001 From: "Gabriel L. Somlo" Date: Wed, 29 Apr 2015 11:21:51 -0400 Subject: fw_cfg: prevent selector key conflict Enforce a single assignment of data for each distinct selector key. Signed-off-by: Gabriel Somlo Reviewed-by: Laszlo Ersek Signed-off-by: Gerd Hoffmann --- 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; -- cgit v1.1