[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v1 06/10] plugins: Assert mmu_idx in range before use in qemu_plu
From: |
Alex Bennée |
Subject: |
[PATCH v1 06/10] plugins: Assert mmu_idx in range before use in qemu_plugin_get_hwaddr |
Date: |
Wed, 21 Sep 2022 17:07:57 +0100 |
From: Richard Henderson <richard.henderson@linaro.org>
Coverity reports out-of-bound accesses here. This should be a
false positive due to how the index is decoded from MemOpIdx.
Fixes: Coverity CID 1487201
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Damien Hedde <damien.hedde@greensocs.com>
Message-Id: <20220401190233.329360-1-richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
plugins/api.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/plugins/api.c b/plugins/api.c
index 7bf71b189d..2078b16edb 100644
--- a/plugins/api.c
+++ b/plugins/api.c
@@ -289,6 +289,8 @@ struct qemu_plugin_hwaddr
*qemu_plugin_get_hwaddr(qemu_plugin_meminfo_t info,
enum qemu_plugin_mem_rw rw = get_plugin_meminfo_rw(info);
hwaddr_info.is_store = (rw & QEMU_PLUGIN_MEM_W) != 0;
+ assert(mmu_idx < NB_MMU_MODES);
+
if (!tlb_plugin_lookup(cpu, vaddr, mmu_idx,
hwaddr_info.is_store, &hwaddr_info)) {
error_report("invalid use of qemu_plugin_get_hwaddr");
--
2.34.1
- [PATCH v1 01/10] monitor: expose monitor_puts to rest of code, (continued)
- [PATCH v1 01/10] monitor: expose monitor_puts to rest of code, Alex Bennée, 2022/09/21
- [PATCH v1 04/10] tests/tcg: add memory-sve test for aarch64, Alex Bennée, 2022/09/21
- [PATCH v1 03/10] disas: use result of ->read_memory_func, Alex Bennée, 2022/09/21
- [PATCH v1 08/10] docs/devel: move API to end of tcg-plugins.rst, Alex Bennée, 2022/09/21
- [PATCH v1 06/10] plugins: Assert mmu_idx in range before use in qemu_plugin_get_hwaddr,
Alex Bennée <=
- [PATCH v1 02/10] disas: generalise plugin_printf and use for monitor_disas, Alex Bennée, 2022/09/21
- [PATCH v1 07/10] docs/devel: clean-up qemu invocations in tcg-plugins, Alex Bennée, 2022/09/21
- [PATCH v1 05/10] plugins: extend execlog to filter matches, Alex Bennée, 2022/09/21
- [PATCH v1 09/10] contrib/plugins: reset skip when matching in execlog, Alex Bennée, 2022/09/21
- [PATCH v1 10/10] docs/devel: document the test plugins, Alex Bennée, 2022/09/21