iommu_gas: Fix a recent regression with IOMMU_MF_CANSPLIT

As of 19bb5a7244, the IOMMU_MF_CANSPLIT case in iommu_gas_match_one()
must take into account the specified offset.  Otherwise, the recently
changed end calculation in iommu_gas_match_insert() could produce an
end address that crosses the specified boundary by one page.

Reviewed by:	dougm
MFC with:	19bb5a7244
This commit is contained in:
Alan Cox 2022-06-26 11:48:12 -05:00
parent 841719c08f
commit 7b39a9bc1d

View File

@ -350,7 +350,7 @@ iommu_gas_match_one(struct iommu_gas_match_args *a, iommu_gaddr_t beg,
* the next entry, then we do not have gap. Ignore for now.
*/
if ((a->gas_flags & IOMMU_MF_CANSPLIT) != 0) {
a->size = bs - a->entry->start;
a->size = bs - a->entry->start - a->offset;
return (true);
}