diff options
| author | Xiaoyao Li <xiaoyao.li@intel.com> | 2025-07-28 19:57:06 +0800 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2025-09-17 19:01:57 +0200 |
| commit | 80030f66ad15c1534f5e3700b0acefd6d0d92e37 (patch) | |
| tree | 117a20e24ac8f54fba02d0c5fde509e2a1d675fc | |
| parent | 706cc708656c91552b355faa9b72dfa7ad64571e (diff) | |
| download | focaccia-qemu-80030f66ad15c1534f5e3700b0acefd6d0d92e37.tar.gz focaccia-qemu-80030f66ad15c1534f5e3700b0acefd6d0d92e37.zip | |
accel/kvm: Zero out mem explicitly in kvm_set_user_memory_region()
Zero out the entire mem explicitly before it's used, to ensure the unused
feilds (pad1, pad2) are all zeros. Otherwise, it might cause problem when
the pad fields are extended by future KVM.
Fixes: ce5a983233b4 ("kvm: Enable KVM_SET_USER_MEMORY_REGION2 for memslot")
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/r/20250728115707.1374614-3-xiaoyao.li@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| -rw-r--r-- | accel/kvm/kvm-all.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 633b72bde2..72b571a697 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -358,7 +358,7 @@ int kvm_physical_memory_addr_from_host(KVMState *s, void *ram, static int kvm_set_user_memory_region(KVMMemoryListener *kml, KVMSlot *slot, bool new) { KVMState *s = kvm_state; - struct kvm_userspace_memory_region2 mem; + struct kvm_userspace_memory_region2 mem = {}; int ret; mem.slot = slot->slot | (kml->as_id << 16); |