xen: Don't pass MemoryListener around by value

Coverity points out (CID 1513106, 1513107) that MemoryListener is a
192 byte struct which we are passing around by value.  Switch to
passing a const pointer into xen_register_ioreq() and then to
xen_do_ioreq_register().  We can also make the file-scope
MemoryListener variables const, since nothing changes them.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230718101057.1110979-1-peter.maydell@linaro.org>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
This commit is contained in:
Peter Maydell 2023-07-18 11:10:57 +01:00 committed by Anthony PERARD
parent f4f71363fc
commit bcb40db010
4 changed files with 9 additions and 9 deletions

View file

@ -458,7 +458,7 @@ static void xen_log_global_stop(MemoryListener *listener)
xen_in_migration = false;
}
static MemoryListener xen_memory_listener = {
static const MemoryListener xen_memory_listener = {
.name = "xen-memory",
.region_add = xen_region_add,
.region_del = xen_region_del,
@ -582,7 +582,7 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory)
state = g_new0(XenIOState, 1);
xen_register_ioreq(state, max_cpus, xen_memory_listener);
xen_register_ioreq(state, max_cpus, &xen_memory_listener);
QLIST_INIT(&xen_physmap);
xen_read_physmap(state);