git: 11d08e7e8d6c - main - arm/gic: fix a KASSERT in arm_gic_reserve_msi_range()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Mon, 22 Aug 2022 12:01:14 UTC
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=11d08e7e8d6ca4de0852b2998593a295b04cb567

commit 11d08e7e8d6ca4de0852b2998593a295b04cb567
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-08-22 11:51:37 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-08-22 11:59:02 +0000

    arm/gic: fix a KASSERT in arm_gic_reserve_msi_range()
    
    Fix the off-by-one in the KASSERT in arm_gic_reserve_msi_range()
    allowing the MSIs being allocated at the end of the IRQ range.
    
    Reported by:    bz
    Submitted by:   andrew
    Reviewed by:    andrew
    MFC after:      3 days
    Differential Revision: https://reviews.freebsd.org/D36291
---
 sys/arm/arm/gic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/arm/arm/gic.c b/sys/arm/arm/gic.c
index 93bfdc29d930..d2d88237935e 100644
--- a/sys/arm/arm/gic.c
+++ b/sys/arm/arm/gic.c
@@ -288,7 +288,7 @@ arm_gic_reserve_msi_range(device_t dev, u_int start, u_int count)
 
 	sc = device_get_softc(dev);
 
-	KASSERT((start + count) < sc->nirqs,
+	KASSERT((start + count) <= sc->nirqs,
 	    ("%s: Trying to allocate too many MSI IRQs: %d + %d > %d", __func__,
 	    start, count, sc->nirqs));
 	for (i = 0; i < count; i++) {