]> git.proxmox.com Git - mirror_qemu.git/commitdiff
softmmu/physmem: Silence GCC 10 maybe-uninitialized error
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>
Sun, 17 Jan 2021 17:04:11 +0000 (18:04 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 23 Jan 2021 14:26:35 +0000 (09:26 -0500)
When building with GCC 10.2 configured with --extra-cflags=-Os, we get:

  softmmu/physmem.c: In function 'address_space_translate_for_iotlb':
  softmmu/physmem.c:643:26: error: 'notifier' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    643 |         notifier->active = true;
        |                          ^
  softmmu/physmem.c:608:23: note: 'notifier' was declared here
    608 |     TCGIOMMUNotifier *notifier;
        |                       ^~~~~~~~

Initialize 'notifier' to silence the warning.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210117170411.4106949-1-f4bug@amsat.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
softmmu/physmem.c

index 6301f4f0a5c9f47028617627cbd38e1658ffc424..cdcd197656f5fa46ce0576511862f763029ed65b 100644 (file)
@@ -605,7 +605,7 @@ static void tcg_register_iommu_notifier(CPUState *cpu,
      * when the IOMMU tells us the mappings we've cached have changed.
      */
     MemoryRegion *mr = MEMORY_REGION(iommu_mr);
-    TCGIOMMUNotifier *notifier;
+    TCGIOMMUNotifier *notifier = NULL;
     int i;
 
     for (i = 0; i < cpu->iommu_notifiers->len; i++) {