From: Yan Zhao Date: Mon, 24 Jun 2019 09:18:10 +0000 (+0800) Subject: intel_iommu: Fix incorrect "end" for vtd_address_space_unmap X-Git-Tag: v4.1.0-rc0~8^2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d6d10793dcfa33504745be40b49bd747ff8752ef;p=thirdparty%2Fqemu.git intel_iommu: Fix incorrect "end" for vtd_address_space_unmap IOMMUNotifier is with inclusive ranges, so we should check against (VTD_ADDRESS_SIZE(s->aw_bits) - 1). Signed-off-by: Yan Zhao [peterx: split from another bigger patch] Reviewed-by: Eric Auger Signed-off-by: Peter Xu Message-Id: <20190624091811.30412-2-peterx@redhat.com> Signed-off-by: Paolo Bonzini --- diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 44b12311579..719ce19ab38 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -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);