From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Eric Blake <eblake@redhat.com>, Tony Nguyen <tony.nguyen@bt.com>,
qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH] memory: Set notdirty_mem_ops validator
Date: Fri, 6 Sep 2019 15:24:34 +0200 [thread overview]
Message-ID: <867bdb4b-3eef-0660-6db2-a2e6a0ab5a0e@redhat.com> (raw)
In-Reply-To: <93172f42-7506-65d0-5754-248c3fc31aa1@redhat.com>
On 9/6/19 3:08 PM, Eric Blake wrote:
> On 9/6/19 3:28 AM, Philippe Mathieu-Daudé wrote:
>> On 9/2/19 3:26 AM, Tony Nguyen wrote:
>>> Existing read rejecting validator was mistakenly cleared.
>>>
>>> Reads dispatched to io_mem_notdirty then segfaults as there is no read
>>> handler.
>>>
>>> Signed-off-by: Tony Nguyen <tony.nguyen@bt.com>
>>> ---
>>> exec.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/exec.c b/exec.c
>>> index 1df966d17a..05d664541f 100644
>>> --- a/exec.c
>>> +++ b/exec.c
>>> @@ -2796,12 +2796,12 @@ static bool notdirty_mem_accepts(void *opaque, hwaddr addr,
>>>
>>> static const MemoryRegionOps notdirty_mem_ops = {
>>> .write = notdirty_mem_write,
>>> - .valid.accepts = notdirty_mem_accepts,
>>> .endianness = DEVICE_NATIVE_ENDIAN,
>>> .valid = {
>>> .min_access_size = 1,
>>> .max_access_size = 8,
>>> .unaligned = false,
>>> + .accepts = notdirty_mem_accepts,
>>
>> I'm surprised the compiler doesn't emit any warning...
>
> Same here.
>
> But reading
> https://en.cppreference.com/w/c/language/struct_initialization, this is
> compliant behavior:
>
> "However, when an initializer begins with a left open brace, its current
> object is fully re-initialized and any prior explicit initializers for
> any of its subobjects are ignored:"
>
> so it is worth filing a gcc bug asking for a QoI improvement in adding a
> warning (since the code does not violate the C standard, but does cause
> surprises in the reinitialization of omitted members in the later {} to
> go back to 0 in spite of the earlier initialization by nested name).
Just remembered another case of (correct) reinitialization in
hw/arm/palm.c:101:
static struct {
int row;
int column;
} palmte_keymap[0x80] = {
[0 ... 0x7f] = { -1, -1 },
[0x3b] = { 0, 0 }, /* F1 -> Calendar */
[0x3c] = { 1, 0 }, /* F2 -> Contacts */
[0x3d] = { 2, 0 }, /* F3 -> Tasks List */
[0x3e] = { 3, 0 }, /* F4 -> Note Pad */
[0x01] = { 4, 0 }, /* Esc -> Power */
[0x4b] = { 0, 1 }, /* Left */
[0x50] = { 1, 1 }, /* Down */
[0x48] = { 2, 1 }, /* Up */
[0x4d] = { 3, 1 }, /* Right */
[0x4c] = { 4, 1 }, /* Centre */
[0x39] = { 4, 1 }, /* Spc -> Centre */
};
next prev parent reply other threads:[~2019-09-06 13:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-02 1:26 [Qemu-devel] [PATCH] memory: Set notdirty_mem_ops validator Tony Nguyen
2019-09-03 10:21 ` Peter Xu
2019-09-03 10:25 ` Peter Maydell
2019-09-03 16:47 ` Tony Nguyen
2019-09-03 16:50 ` Peter Maydell
2019-09-04 2:40 ` Peter Xu
2019-09-06 14:14 ` Peter Maydell
2019-09-04 6:17 ` Tony Nguyen
2019-09-06 8:28 ` Philippe Mathieu-Daudé
2019-09-06 13:08 ` Eric Blake
2019-09-06 13:24 ` Philippe Mathieu-Daudé [this message]
2019-09-06 13:44 ` Eric Blake
2019-09-06 16:04 ` Eric Blake
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=867bdb4b-3eef-0660-6db2-a2e6a0ab5a0e@redhat.com \
--to=philmd@redhat.com \
--cc=eblake@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=tony.nguyen@bt.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).