qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kvm: Initialize kvm_physical_log_clear ret local variable
@ 2019-10-03 11:32 Eric Auger
  0 siblings, 0 replies; only message in thread
From: Eric Auger @ 2019-10-03 11:32 UTC (permalink / raw)
  To: eric.auger.pro, eric.auger, qemu-devel, pbonzini

If there is no slot in the section ret is not initialized. This triggers
a compilation error at caller site.

error: ‘ret’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
     if (r < 0) {

Fixes: 84516e5b8d ("kvm: clear dirty bitmaps from all overlapping memslots")
Signed-off-by: Eric Auger <eric.auger@redhat.com>
---
 accel/kvm/kvm-all.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index aabe097c41..e2605da22e 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -712,7 +712,7 @@ static int kvm_physical_log_clear(KVMMemoryListener *kml,
     KVMState *s = kvm_state;
     uint64_t start, size, offset, count;
     KVMSlot *mem;
-    int ret, i;
+    int ret = 0, i;
 
     if (!s->manual_dirty_log_protect) {
         /* No need to do explicit clear */
-- 
2.20.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-10-03 11:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-03 11:32 [PATCH] kvm: Initialize kvm_physical_log_clear ret local variable Eric Auger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).