aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2023-12-26 00:57:00 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2023-12-26 01:28:22 +0000
commita869643e184a73382ef7939b465fd42785e096d1 (patch)
treeb782cc5ce5248ef25575e2924248f966b5f0a959
parent7153d5e4bc67732f8258d50ffffa42a09a19b427 (diff)
iommu_gas_match_one(): check for underflow
Sponsored by: The FreeBSD Foundation MFC after: 1 week
-rw-r--r--sys/dev/iommu/iommu_gas.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/dev/iommu/iommu_gas.c b/sys/dev/iommu/iommu_gas.c
index 4e0bfb116116..cc541e748f48 100644
--- a/sys/dev/iommu/iommu_gas.c
+++ b/sys/dev/iommu/iommu_gas.c
@@ -329,6 +329,8 @@ iommu_gas_match_one(struct iommu_gas_match_args *a, iommu_gaddr_t beg,
start = roundup2(beg, a->common->alignment);
if (start < beg)
return (false);
+ if (end < IOMMU_PAGE_SIZE + 1)
+ return (false);
end = MIN(end - IOMMU_PAGE_SIZE - 1, ubound);
offset = a->offset;
size = a->size;