[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] memory: Set notdirty_mem_ops validator
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH] memory: Set notdirty_mem_ops validator |
Date: |
Fri, 6 Sep 2019 08:08:04 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
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 <address@hidden>
>> ---
>> 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).
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH] memory: Set notdirty_mem_ops validator, Philippe Mathieu-Daudé, 2019/09/06
- Re: [Qemu-devel] [PATCH] memory: Set notdirty_mem_ops validator,
Eric Blake <=