From e6775534aee1963a39e5ee762b8eab1d7dfb1b6b Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 17 Jun 2022 12:03:06 -0500 Subject: [PATCH] iommu_gas: Correct a broken KASSERT If iommu_gas_find_space() ever called iommu_gas_uppermatch(), and it succeeded in allocating space, then the subsequent KASSERT would be triggered. Change that KASSERT to accept either success or ENOMEM. MFC after: 1 week --- sys/dev/iommu/iommu_gas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/iommu/iommu_gas.c b/sys/dev/iommu/iommu_gas.c index a65bb23e87c5..073b5626edf6 100644 --- a/sys/dev/iommu/iommu_gas.c +++ b/sys/dev/iommu/iommu_gas.c @@ -504,7 +504,7 @@ iommu_gas_find_space(struct iommu_domain *domain, if (common->highaddr >= domain->end) return (ENOMEM); error = iommu_gas_uppermatch(&a, RB_ROOT(&domain->rb_root)); - KASSERT(error == ENOMEM, + KASSERT(error == 0 || error == ENOMEM, ("error %d from iommu_gas_uppermatch", error)); return (error); }