From: Peter Xu <peterx@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-devel@nongnu.org, David Hildenbrand <david@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [PATCH] memory: Fix addr for flatview_access_allowed()
Date: Wed, 3 Sep 2025 09:09:27 -0400 [thread overview]
Message-ID: <aLg-B020VAPtAE-1@x1.local> (raw)
In-Reply-To: <2f195d44-21e6-4829-9e5b-03177452b889@linaro.org>
On Wed, Sep 03, 2025 at 12:38:19PM +0200, Philippe Mathieu-Daudé wrote:
> On 2/9/25 23:40, Peter Xu wrote:
> > flatview_access_allowed() should pass in the address offset of the memory
> > region, rather than the global address space.
> >
> > Shouldn't be a major issue yet, since the addr is only used in an error
> > log.
> >
> > Cc: Philippe Mathieu-Daudé <philmd@linaro.org>
> > Fixes: 3ab6fdc91b ("softmmu/physmem: Introduce MemTxAttrs::memory field and MEMTX_ACCESS_ERROR")
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> > ---
> > system/physmem.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/system/physmem.c b/system/physmem.c
> > index f498572fc8..019118cf75 100644
> > --- a/system/physmem.c
> > +++ b/system/physmem.c
> > @@ -3027,7 +3027,7 @@ static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
> > l = len;
> > mr = flatview_translate(fv, addr, &mr_addr, &l, true, attrs);
> > - if (!flatview_access_allowed(mr, attrs, addr, len)) {
> > + if (!flatview_access_allowed(mr, attrs, mr_addr, len)) {
>
> Right, but shouldn't we also use the translated length?
>
> if (!flatview_access_allowed(mr, attrs, mr_addr, l)) {
Yes.. I'll repost, thanks. :)
>
> > return MEMTX_ACCESS_ERROR;
> > }
> > return flatview_write_continue(fv, addr, attrs, buf, len,
> > @@ -3118,7 +3118,7 @@ static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
> > l = len;
> > mr = flatview_translate(fv, addr, &mr_addr, &l, false, attrs);
> > - if (!flatview_access_allowed(mr, attrs, addr, len)) {
> > + if (!flatview_access_allowed(mr, attrs, mr_addr, len)) {
>
> Ditto.
>
> > return MEMTX_ACCESS_ERROR;
> > }
> > return flatview_read_continue(fv, addr, attrs, buf, len,
>
--
Peter Xu
prev parent reply other threads:[~2025-09-03 13:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-02 21:40 [PATCH] memory: Fix addr for flatview_access_allowed() Peter Xu
2025-09-03 7:53 ` David Hildenbrand
2025-09-03 10:38 ` Philippe Mathieu-Daudé
2025-09-03 13:09 ` Peter Xu [this message]
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=aLg-B020VAPtAE-1@x1.local \
--to=peterx@redhat.com \
--cc=david@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.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).