mirror of
https://github.com/qemu/qemu.git
synced 2024-11-26 12:23:36 +08:00
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>
This commit is contained in:
parent
023e314856
commit
0f9b214139
@ -423,6 +423,7 @@ static void fw_cfg_add_bytes_read_callback(FWCfgState *s, uint16_t key,
|
|||||||
key &= FW_CFG_ENTRY_MASK;
|
key &= FW_CFG_ENTRY_MASK;
|
||||||
|
|
||||||
assert(key < FW_CFG_MAX_ENTRY && len < UINT32_MAX);
|
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].data = data;
|
||||||
s->entries[arch][key].len = (uint32_t)len;
|
s->entries[arch][key].len = (uint32_t)len;
|
||||||
|
Loading…
Reference in New Issue
Block a user