aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Moore <dougm@FreeBSD.org>2022-04-20 22:24:11 +0000
committerDoug Moore <dougm@FreeBSD.org>2022-04-20 22:24:11 +0000
commit11fced21ccea1b80327d159a4c27046cb1f46952 (patch)
treee3d990cadda064567c4adb8ec79903fe35b1fbde
parent1a7f22d9c211f504f6c48a86401469181a67ec34 (diff)
downloadsrc-11fced21ccea1b80327d159a4c27046cb1f46952.tar.gz
src-11fced21ccea1b80327d159a4c27046cb1f46952.zip
dev/iommu: Include offset in maxaddr check.
If iommu_gas_match_one has to adjust for a boundary crossing, its check against maxaddr includes 'offset' in its calculation, to ensure that the allocated memory does not exceed the max address. However, if there's no boundary crossing adjustment, then the maxaddr check disregards 'offset'. Fix that. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D34978
-rw-r--r--sys/dev/iommu/iommu_gas.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/dev/iommu/iommu_gas.c b/sys/dev/iommu/iommu_gas.c
index 043bd0e0f039..c0d4f84a3f1c 100644
--- a/sys/dev/iommu/iommu_gas.c
+++ b/sys/dev/iommu/iommu_gas.c
@@ -305,7 +305,7 @@ iommu_gas_match_one(struct iommu_gas_match_args *a, iommu_gaddr_t beg,
a->entry->start = roundup2(beg + IOMMU_PAGE_SIZE,
a->common->alignment);
- if (a->entry->start + a->size > maxaddr)
+ if (a->entry->start + a->offset + a->size > maxaddr)
return (false);
/* IOMMU_PAGE_SIZE to create gap after new entry. */