git: 7c94d515db90 - main - aio_kqueue_test: Fix CID 1558429

From: David Bright <dab_at_FreeBSD.org>
Date: Thu, 09 Jan 2025 14:43:29 UTC
The branch main has been updated by dab:

URL: https://cgit.FreeBSD.org/src/commit/?id=7c94d515db900401a339cd26861856c8fefb3086

commit 7c94d515db900401a339cd26861856c8fefb3086
Author:     David Bright <dab@FreeBSD.org>
AuthorDate: 2025-01-05 17:24:13 +0000
Commit:     David Bright <dab@FreeBSD.org>
CommitDate: 2025-01-09 14:42:36 +0000

    aio_kqueue_test: Fix CID 1558429
    
    Fix a Coverity error in the aio_kqueue_test that could theoretically
    (but probably not realistically) cause overindexing an array.
    
    Differential Revision: https://reviews.freebsd.org/D48328
    Reviewed by: asomers, vangyzen
    Sponsored by: Dell Technologies
---
 tests/sys/aio/aio_kqueue_test.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/sys/aio/aio_kqueue_test.c b/tests/sys/aio/aio_kqueue_test.c
index c2478a9d05b3..5e5cb40d0752 100644
--- a/tests/sys/aio/aio_kqueue_test.c
+++ b/tests/sys/aio/aio_kqueue_test.c
@@ -35,6 +35,7 @@
 #include <sys/types.h>
 #include <sys/event.h>
 #include <sys/time.h>
+#include <assert.h>
 #include <aio.h>
 #include <err.h>
 #include <errno.h>
@@ -192,6 +193,7 @@ main (int argc, char *argv[])
 
 			for (j = 0; j < max_queue_per_proc && iocb[j] != kq_iocb;
 			   j++) ;
+			assert(j < max_queue_per_proc);
 #ifdef DEBUG
 			printf("kq_iocb %p\n", kq_iocb);