]> xenbits.xensource.com Git - xen.git/commitdiff
VT-d: correct off-by-1 in fault register range check
authorJan Beulich <jbeulich@suse.com>
Wed, 24 Nov 2021 10:12:03 +0000 (11:12 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 24 Nov 2021 10:12:03 +0000 (11:12 +0100)
All our present implementation requires is that the range fully fits
in a single page. No need to exclude the case of the last register
extending right to the end of that page.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
xen/drivers/passthrough/vtd/iommu.c

index dab8590e25ab65bd42b55eff97aeb0b868d21486..c1bf48cbcb4049020cff333c7af4b45945ac1b6f 100644 (file)
@@ -1273,7 +1273,7 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd)
     quirk_iommu_caps(iommu);
 
     if ( cap_fault_reg_offset(iommu->cap) +
-         cap_num_fault_regs(iommu->cap) * PRIMARY_FAULT_REG_LEN >= PAGE_SIZE ||
+         cap_num_fault_regs(iommu->cap) * PRIMARY_FAULT_REG_LEN > PAGE_SIZE ||
          ecap_iotlb_offset(iommu->ecap) >= PAGE_SIZE )
     {
         printk(XENLOG_ERR VTDPREFIX "IOMMU: unsupported\n");