From: David Hildenbrand <david@redhat.com>
To: Zhenzhong Duan <zhenzhong.duan@intel.com>, qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, peterx@redhat.com, f4bug@amsat.org
Subject: Re: [PATCH] softmmu/physmem: Fix input parameters for flatview_access_allowed()
Date: Fri, 22 Jul 2022 08:49:26 +0200 [thread overview]
Message-ID: <b63cb739-06b5-6a97-4b23-fce36ef52ef2@redhat.com> (raw)
In-Reply-To: <20220622012839.3419865-1-zhenzhong.duan@intel.com>
On 22.06.22 03:28, Zhenzhong Duan wrote:
> The comment of flatview_access_allowed() suggests to pass address
> within that memory region, this isn't ture in some call sites.
s/ture/true/
>
> This makes qemu log in flatview_access_allowed() confusing and
> potential risk if the input parameter will be checked in the future.
>
> Fixes: 3ab6fdc91b72 ("softmmu/physmem: Introduce MemTxAttrs::memory field and MEMTX_ACCESS_ERROR")
My opinion is to not use fixes tags unless there is really something
broken -- a user-visible effect of a BUG exists.
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
> ---
> softmmu/physmem.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/softmmu/physmem.c b/softmmu/physmem.c
> index fb16be57a6c6..214cb04c8fc3 100644
> --- a/softmmu/physmem.c
> +++ b/softmmu/physmem.c
> @@ -2850,7 +2850,7 @@ static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
>
> l = len;
> mr = flatview_translate(fv, addr, &addr1, &l, true, attrs);
> - if (!flatview_access_allowed(mr, attrs, addr, len)) {
> + if (!flatview_access_allowed(mr, attrs, addr1, l)) {
> return MEMTX_ACCESS_ERROR;
> }
> return flatview_write_continue(fv, addr, attrs, buf, len,
> @@ -2917,7 +2917,7 @@ static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
>
> l = len;
> mr = flatview_translate(fv, addr, &addr1, &l, false, attrs);
> - if (!flatview_access_allowed(mr, attrs, addr, len)) {
> + if (!flatview_access_allowed(mr, attrs, addr1, l)) {
> return MEMTX_ACCESS_ERROR;
> }
> return flatview_read_continue(fv, addr, attrs, buf, len,
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2022-07-22 7:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-22 1:28 [PATCH] softmmu/physmem: Fix input parameters for flatview_access_allowed() Zhenzhong Duan
2022-06-22 21:02 ` Peter Xu
2022-07-22 3:31 ` Duan, Zhenzhong
2022-07-22 6:49 ` David Hildenbrand [this message]
2022-07-22 7:52 ` Duan, Zhenzhong
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=b63cb739-06b5-6a97-4b23-fce36ef52ef2@redhat.com \
--to=david@redhat.com \
--cc=f4bug@amsat.org \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=zhenzhong.duan@intel.com \
/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).