Skip to contentSkip to conversation

kvm: Initialize kvm_physical_log_clear ret local variable

PATCH New Eric Auger 1 participant 1 message Oct 3, 2019

lore
Share & tools
lore

Eric Auger

author
#0 lore raw

PATCH 1/1 kvm: Initialize kvm_physical_log_clear ret local variable

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")
---
 accel/kvm/kvm-all.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
accel/kvm/kvm-all.c +1 -1
index aabe097c41..e2605da22e 100644
@@ -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 */
Signature · 1 line
2.20.1