From: Laszlo Ersek <lersek@redhat.com>
To: Li Qiang <liq3ea@gmail.com>, Peter Maydell <peter.maydell@linaro.org>
Cc: mst@redhat.com, ehabkost@redhat.com,
"Marc-André Lureau" <marcandre.lureau@gmail.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"P J P" <ppandit@redhat.com>,
"Qemu Developers" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] memory region: check the old.mmio.read status
Date: Wed, 12 Sep 2018 19:45:18 +0200 [thread overview]
Message-ID: <5abd7fa1-09ee-f2a7-3b1f-539195fb9288@redhat.com> (raw)
In-Reply-To: <CAKXe6S+k5M5rr2ZEcq4KxryHMajcTrze9CVcKRSEFXJJ9qVX0A@mail.gmail.com>
On 09/12/18 16:28, Li Qiang wrote:
> Peter Maydell <peter.maydell@linaro.org> 于2018年9月12日周三 下午8:55写道:
>
>> On 12 September 2018 at 13:32, Li Qiang <liq3ea@gmail.com> wrote:
>>> To avoid NULL-deref for the devices without read callbacks
>>>
>>> Signed-off-by: Li Qiang <liq3ea@gmail.com>
>>> ---
>>> memory.c | 4 ++++
>>> 1 file changed, 4 insertions(+)
>>>
>>> diff --git a/memory.c b/memory.c
>>> index 9b73892768..48d025426b 100644
>>> --- a/memory.c
>>> +++ b/memory.c
>>> @@ -406,6 +406,10 @@ static MemTxResult
>> memory_region_oldmmio_read_accessor(MemoryRegion *mr,
>>> {
>>> uint64_t tmp;
>>>
>>> + if (!mr->ops->old_mmio.read[ctz32(size)]) {
>>> + return MEMTX_DECODE_ERROR;
>>> + }
>>> +
>>> tmp = mr->ops->old_mmio.read[ctz32(size)](mr->opaque, addr);
>>> if (mr->subpage) {
>>> trace_memory_region_subpage_read(get_cpu_index(), mr, addr,
>> tmp, size);
>>> --
>>> 2.11.0
>>>
>>
>> There's patches on-list which drop the old_mmio field from the MemoryRegion
>> struct entirely, so I think this patch as it stands is obsolete.
>>
>> Currently our semantics are "you must provide both read and write, even
>> if one of them just always returns 0 / does nothing / returns an error".
>> We could probably reasonably assert this at the point when the
>> MemoryRegionOps is registered.
>>
>
> This patch is sent as the results of this thread:
> -->https://lists.gnu.org/archive/html/qemu-devel/2018-09/msg01332.html
>
> So I think I should send a path set to add all the missing read function
> as Laszlo Ersek points
> in the above thread discussion, right?
Can we introduce a central utility function at least (for a no-op read
returning 0), and initialize the read callbacks in question with the
address of that function?
Thanks,
Laszlo
next prev parent reply other threads:[~2018-09-12 17:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-12 12:32 [Qemu-devel] [PATCH] memory region: check the old.mmio.read status Li Qiang
2018-09-12 12:54 ` Peter Maydell
2018-09-12 14:28 ` Li Qiang
2018-09-12 17:45 ` Laszlo Ersek [this message]
2018-09-12 17:43 ` Laszlo Ersek
2018-09-13 0:31 ` Peter Maydell
2018-09-13 1:36 ` Li Qiang
2018-09-13 4:31 ` Mark Cave-Ayland
2018-09-13 4:45 ` Peter Maydell
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=5abd7fa1-09ee-f2a7-3b1f-539195fb9288@redhat.com \
--to=lersek@redhat.com \
--cc=ehabkost@redhat.com \
--cc=liq3ea@gmail.com \
--cc=marcandre.lureau@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=ppandit@redhat.com \
--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).