> On Sep 14, 2026, at 07:29, Peter Maydell <[email protected]> wrote: > On Fri, 11 Sept 2026 at 20:04, Matthew R. Ochs <[email protected]> wrote: >> >> >> name = g_strdup_printf("%s vintf-page0", >> memory_region_name(&cmdqv->mmio_cmdqv)); >> - cmdqv->mr_vintf_page0 = g_malloc0(sizeof(*cmdqv->mr_vintf_page0)); >> - memory_region_init_ram_device_ptr(cmdqv->mr_vintf_page0, >> + memory_region_init_ram_device_ptr(&cmdqv->mr_vintf_page0, >> >> memory_region_owner(&cmdqv->mmio_cmdqv), >> name, VINTF_PAGE_SIZE, >> cmdqv->vintf_page0); > > ...but we don't actually initialize the MemoryRegion until here. > > I don't think you should assume that memory_region_* functions > will do anything sensible on a zeroed-out lump of memory.
You’re right. Although the current implementation of memory_region_is_mapped() only examines fields that are zero before initialization, using it here relies on the internal representation of an uninitialized MemoryRegion. memory_region_init_ram_device_ptr() has not yet called object_initialize() on the embedded region at that point. I’ll restore the explicit initialization flag from v1 in v3 so that no MemoryRegion API is called before the region has been initialized. Thanks for catching this. -matt
