]> git.proxmox.com Git - mirror_qemu.git/commitdiff
intel_iommu: Fix incorrect "end" for vtd_address_space_unmap
authorYan Zhao <yan.y.zhao@intel.com>
Mon, 24 Jun 2019 09:18:10 +0000 (17:18 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 5 Jul 2019 20:16:46 +0000 (22:16 +0200)
IOMMUNotifier is with inclusive ranges, so we should check
against (VTD_ADDRESS_SIZE(s->aw_bits) - 1).

Signed-off-by: Yan Zhao <yan.y.zhao@intel.com>
[peterx: split from another bigger patch]
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20190624091811.30412-2-peterx@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/i386/intel_iommu.c

index 44b12311579bfdfaff7bc852dc9939851f38c1c6..719ce19ab383e21e8f18d39aeaa0e71b429e13d2 100644 (file)
@@ -3379,12 +3379,12 @@ static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n)
      * VT-d spec), otherwise we need to consider overflow of 64 bits.
      */
 
-    if (end > VTD_ADDRESS_SIZE(s->aw_bits)) {
+    if (end > VTD_ADDRESS_SIZE(s->aw_bits) - 1) {
         /*
          * Don't need to unmap regions that is bigger than the whole
          * VT-d supported address space size
          */
-        end = VTD_ADDRESS_SIZE(s->aw_bits);
+        end = VTD_ADDRESS_SIZE(s->aw_bits) - 1;
     }
 
     assert(start <= end);