From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: qemu-devel@nongnu.org
Cc: sstabellini@kernel.org, anthony@xenproject.org, paul@xen.org,
alex.bennee@linaro.org, peter.maydell@linaro.org,
richard.henderson@linaro.org, edgar.iglesias@amd.com,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Peter Xu" <peterx@redhat.com>,
"David Hildenbrand" <david@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PULL v1 2/3] physmem: Bail out qemu_ram_block_from_host() for invalid ram addrs
Date: Fri, 12 Jul 2024 13:02:29 +0200 [thread overview]
Message-ID: <20240712110230.4098056-3-edgar.iglesias@gmail.com> (raw)
In-Reply-To: <20240712110230.4098056-1-edgar.iglesias@gmail.com>
From: "Edgar E. Iglesias" <edgar.iglesias@amd.com>
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 <edgar.iglesias@amd.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
system/physmem.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/system/physmem.c b/system/physmem.c
index 14aa025d41..2154432cb6 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;
--
2.43.0
next prev parent reply other threads:[~2024-07-12 11:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-12 11:02 [PULL v1 0/3] Xen queue Edgar E. Iglesias
2024-07-12 11:02 ` [PULL v1 1/3] MAINTAINERS: add Edgar as Xen maintainer Edgar E. Iglesias
2024-07-12 11:02 ` Edgar E. Iglesias [this message]
2024-07-12 11:02 ` [PULL v1 3/3] xen: mapcache: Fix unmapping of first entries in buckets Edgar E. Iglesias
2024-07-12 22:11 ` [PULL v1 0/3] Xen queue Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240712110230.4098056-3-edgar.iglesias@gmail.com \
--to=edgar.iglesias@gmail.com \
--cc=alex.bennee@linaro.org \
--cc=anthony@xenproject.org \
--cc=david@redhat.com \
--cc=edgar.iglesias@amd.com \
--cc=paul@xen.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=sstabellini@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).