qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] hw/nvram/fw_cfg: Assert linked data is not NULL


From: Philippe Mathieu-Daudé
Subject: [PATCH] hw/nvram/fw_cfg: Assert linked data is not NULL
Date: Wed, 16 Sep 2020 16:05:35 +0200

The linked data passed to the fw_cfg device must not be NULL.
Add an assertion.

Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@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 f3a4728288e..40dcc08b57b 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -711,6 +711,7 @@ static void fw_cfg_add_bytes_callback(FWCfgState *s, 
uint16_t key,
 
     key &= FW_CFG_ENTRY_MASK;
 
+    assert(data);
     assert(key < fw_cfg_max_entry(s) && len < UINT32_MAX);
     assert(s->entries[arch][key].data == NULL); /* avoid key conflict */
 
-- 
2.26.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]