qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/1] kvm: Clear variables which may not be used


From: Li Zhang
Subject: [PATCH 1/1] kvm: Clear variables which may not be used
Date: Mon, 6 Dec 2021 12:27:38 +0100

The variables msi, route in kvm_irqchip_send_msi may be uninitialised
values in some cases. It's necessary to clear them.

Signed-off-by: Li Zhang <lizhang@suse.de>
---
 accel/kvm/kvm-all.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index eecd8031cf..bd50dc6b80 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -1913,10 +1913,8 @@ static KVMMSIRoute *kvm_lookup_msi_route(KVMState *s, 
MSIMessage msg)
 
 int kvm_irqchip_send_msi(KVMState *s, MSIMessage msg)
 {
-    struct kvm_msi msi;
-    KVMMSIRoute *route;
-
     if (kvm_direct_msi_allowed) {
+        struct kvm_msi msi;
         msi.address_lo = (uint32_t)msg.address;
         msi.address_hi = msg.address >> 32;
         msi.data = le32_to_cpu(msg.data);
@@ -1926,6 +1924,7 @@ int kvm_irqchip_send_msi(KVMState *s, MSIMessage msg)
         return kvm_vm_ioctl(s, KVM_SIGNAL_MSI, &msi);
     }
 
+    KVMMSIRoute *route;
     route = kvm_lookup_msi_route(s, msg);
     if (!route) {
         int virq;
-- 
2.31.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]