All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] plugins: Assert mmu_idx in range before use in qemu_plugin_get_hwaddr
@ 2022-04-01 19:02 Richard Henderson
  2022-04-04  8:48 ` Damien Hedde
  2022-04-08 16:32 ` Alex Bennée
  0 siblings, 2 replies; 3+ messages in thread
From: Richard Henderson @ 2022-04-01 19:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee

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>
---
 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.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] plugins: Assert mmu_idx in range before use in qemu_plugin_get_hwaddr
  2022-04-01 19:02 [PATCH] plugins: Assert mmu_idx in range before use in qemu_plugin_get_hwaddr Richard Henderson
@ 2022-04-04  8:48 ` Damien Hedde
  2022-04-08 16:32 ` Alex Bennée
  1 sibling, 0 replies; 3+ messages in thread
From: Damien Hedde @ 2022-04-04  8:48 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: alex.bennee

Reviewed-by: Damien Hedde <damien.hedde@greensocs.com>

On 4/1/22 21:02, Richard Henderson wrote:
> 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>
> ---
>   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");


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] plugins: Assert mmu_idx in range before use in qemu_plugin_get_hwaddr
  2022-04-01 19:02 [PATCH] plugins: Assert mmu_idx in range before use in qemu_plugin_get_hwaddr Richard Henderson
  2022-04-04  8:48 ` Damien Hedde
@ 2022-04-08 16:32 ` Alex Bennée
  1 sibling, 0 replies; 3+ messages in thread
From: Alex Bennée @ 2022-04-08 16:32 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel


Richard Henderson <richard.henderson@linaro.org> writes:

> 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>

Queued to plugins/next, thanks.

-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-08 16:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-01 19:02 [PATCH] plugins: Assert mmu_idx in range before use in qemu_plugin_get_hwaddr Richard Henderson
2022-04-04  8:48 ` Damien Hedde
2022-04-08 16:32 ` Alex Bennée

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.