diff --git a/qemu/exec.c b/qemu/exec.c index 8b49d6b0..1bbddbb6 100644 --- a/qemu/exec.c +++ b/qemu/exec.c @@ -118,7 +118,7 @@ typedef struct subpage_t { MemoryRegion iomem; AddressSpace *as; hwaddr base; - uint16_t sub_section[TARGET_PAGE_SIZE]; + uint16_t sub_section[]; } subpage_t; #define PHYS_SECTION_UNASSIGNED 0 @@ -1673,7 +1673,7 @@ static subpage_t *subpage_init(AddressSpace *as, hwaddr base) { subpage_t *mmio; - mmio = g_malloc0(sizeof(subpage_t)); + mmio = g_malloc0(sizeof(subpage_t) + TARGET_PAGE_SIZE * sizeof(uint16_t)); mmio->as = as; mmio->base = base; diff --git a/qemu/memory.c b/qemu/memory.c index f6bd8f9f..16f1f050 100644 --- a/qemu/memory.c +++ b/qemu/memory.c @@ -1706,8 +1706,8 @@ bool memory_region_present(MemoryRegion *container, hwaddr addr) return mr && mr != container; } -static void listener_add_address_space(MemoryListener *listener, - AddressSpace *as) +static QEMU_UNUSED_FUNC void listener_add_address_space(MemoryListener *listener, + AddressSpace *as) { FlatView *view; FlatRange *fr;