summary refs log tree commit diff stats
path: root/hw/xen/xen-hvm-common.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2023-07-18 11:10:57 +0100
committerAnthony PERARD <anthony.perard@citrix.com>2023-08-01 10:22:33 +0100
commitbcb40db010517120dfffccc77cef9e4fcd3235fa (patch)
tree3bf6126fd98bab4626d7cb814dc3ba5e74c7f525 /hw/xen/xen-hvm-common.c
parentf4f71363fcdb1092ff64d2bba6f9af39570c2f2b (diff)
downloadfocaccia-qemu-bcb40db010517120dfffccc77cef9e4fcd3235fa.tar.gz
focaccia-qemu-bcb40db010517120dfffccc77cef9e4fcd3235fa.zip
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>
Diffstat (limited to 'hw/xen/xen-hvm-common.c')
-rw-r--r--hw/xen/xen-hvm-common.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c
index 886c3ee944..565dc39c8f 100644
--- a/hw/xen/xen-hvm-common.c
+++ b/hw/xen/xen-hvm-common.c
@@ -765,8 +765,8 @@ void xen_shutdown_fatal_error(const char *fmt, ...)
 }
 
 static void xen_do_ioreq_register(XenIOState *state,
-                                           unsigned int max_cpus,
-                                           MemoryListener xen_memory_listener)
+                                  unsigned int max_cpus,
+                                  const MemoryListener *xen_memory_listener)
 {
     int i, rc;
 
@@ -824,7 +824,7 @@ static void xen_do_ioreq_register(XenIOState *state,
 
     qemu_add_vm_change_state_handler(xen_hvm_change_state_handler, state);
 
-    state->memory_listener = xen_memory_listener;
+    state->memory_listener = *xen_memory_listener;
     memory_listener_register(&state->memory_listener, &address_space_memory);
 
     state->io_listener = xen_io_listener;
@@ -842,7 +842,7 @@ err:
 }
 
 void xen_register_ioreq(XenIOState *state, unsigned int max_cpus,
-                        MemoryListener xen_memory_listener)
+                        const MemoryListener *xen_memory_listener)
 {
     int rc;