]> git.ipfire.org Git - thirdparty/qemu.git/commit
system/physmem: Where we assume we have a RAM MR, assert it
authorPeter Maydell <peter.maydell@linaro.org>
Tue, 23 Jul 2024 17:05:13 +0000 (18:05 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Mon, 29 Jul 2024 16:03:35 +0000 (17:03 +0100)
commit73188068d7ba40c8a37b4763db38bb1ce24ca07d
tree35e0fa8ae2dceec60567b763f6cdf3c6ccc0b2e1
parent525650cd71104c046e4260b5acaeb275f520d5c0
system/physmem: Where we assume we have a RAM MR, assert it

In the functions invalidate_and_set_dirty() and
cpu_physical_memory_snapshot_and_clear_dirty(), we assume that we
are dealing with RAM memory regions. In this case we know that
memory_region_get_ram_addr() will succeed. Assert this before we
use the returned ram_addr_t in arithmetic.

This makes Coverity happier about these functions: it otherwise
complains that we might have an arithmetic overflow that stems
from the possible -1 return from memory_region_get_ram_addr().

Resolves: Coverity CID 15476291547715

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-id: 20240723170513.1676453-1-peter.maydell@linaro.org
system/physmem.c