summary refs log tree commit diff stats
path: root/hw/i386/amd_iommu.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2022-03-21 21:27:14 +0000
committerPeter Maydell <peter.maydell@linaro.org>2022-03-21 21:27:14 +0000
commit48fb0a826eea2e7b0135f49e7fa63e7efe2b7677 (patch)
tree5888a607833f4a9a4b9bd84f4e1494a8c8ddd414 /hw/i386/amd_iommu.c
parent330724977b10f5b92610817e8b7d1dfed122df87 (diff)
parent17e6ffa6a5d2674cb2ebfd967d28b1048261d977 (diff)
downloadfocaccia-qemu-48fb0a826eea2e7b0135f49e7fa63e7efe2b7677.tar.gz
focaccia-qemu-48fb0a826eea2e7b0135f49e7fa63e7efe2b7677.zip
Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging
Bugfixes.

# gpg: Signature made Mon 21 Mar 2022 14:57:57 GMT
# gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
# gpg:                issuer "pbonzini@redhat.com"
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* tag 'for-upstream' of https://gitlab.com/bonzini/qemu:
  hw/i386/amd_iommu: Fix maybe-uninitialized error with GCC 12
  target/i386: kvm: do not access uninitialized variable on older kernels

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/i386/amd_iommu.c')
-rw-r--r--hw/i386/amd_iommu.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
index 9dd9b0ecf2..ea8eaeb330 100644
--- a/hw/i386/amd_iommu.c
+++ b/hw/i386/amd_iommu.c
@@ -913,7 +913,7 @@ static void amdvi_page_walk(AMDVIAddressSpace *as, uint64_t *dte,
         }
 
         /* we are at the leaf page table or page table encodes a huge page */
-        while (level > 0) {
+        do {
             pte_perms = amdvi_get_perms(pte);
             present = pte & 1;
             if (!present || perms != (perms & pte_perms)) {
@@ -932,10 +932,7 @@ static void amdvi_page_walk(AMDVIAddressSpace *as, uint64_t *dte,
             }
             oldlevel = level;
             level = get_pte_translation_mode(pte);
-            if (level == 0x7) {
-                break;
-            }
-        }
+        } while (level > 0 && level < 7);
 
         if (level == 0x7) {
             page_mask = pte_override_page_mask(pte);