git: 8c1edfe309a5 - stable/13 - iommu_gas: Correct a broken KASSERT

From: Doug Moore <dougm_at_FreeBSD.org>
Date: Wed, 06 Jul 2022 17:05:04 UTC
The branch stable/13 has been updated by dougm:

URL: https://cgit.FreeBSD.org/src/commit/?id=8c1edfe309a50744e46aa086257279a322374273

commit 8c1edfe309a50744e46aa086257279a322374273
Author:     Alan Cox <alc@FreeBSD.org>
AuthorDate: 2022-06-17 17:03:06 +0000
Commit:     Doug Moore <dougm@FreeBSD.org>
CommitDate: 2022-07-06 16:51:05 +0000

    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
    
    (cherry picked from commit e6775534aee1963a39e5ee762b8eab1d7dfb1b6b)
---
 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 7ff44a7b0027..d0ed0bde54c0 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);
 }