From 596ccccdbfa124adb42be8c2faf0c74f4849c7a6 Mon Sep 17 00:00:00 2001 From: "Edgar E. Iglesias" Date: Tue, 2 Jul 2024 00:44:20 +0200 Subject: physmem: Bail out qemu_ram_block_from_host() for invalid ram addrs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bail out in qemu_ram_block_from_host() when xen_ram_addr_from_mapcache() does not find an existing mapping. Signed-off-by: Edgar E. Iglesias Reviewed-by: Alex Bennée Reviewed-by: Stefano Stabellini --- system/physmem.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/system/physmem.c b/system/physmem.c index 14aa025..2154432 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -2277,6 +2277,10 @@ RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset, ram_addr_t ram_addr; RCU_READ_LOCK_GUARD(); ram_addr = xen_ram_addr_from_mapcache(ptr); + if (ram_addr == RAM_ADDR_INVALID) { + return NULL; + } + block = qemu_get_ram_block(ram_addr); if (block) { *offset = ram_addr - block->offset; -- cgit v1.1