git: 5f7586197e84 - stable/13 - cred: crget(): Compute initial 'cr_agroups' with nitems()

From: Olivier Certner <olce_at_FreeBSD.org>
Date: Fri, 17 Jan 2025 12:27:08 UTC
The branch stable/13 has been updated by olce:

URL: https://cgit.FreeBSD.org/src/commit/?id=5f7586197e84caa22013bbdb7bef1f5c5ac6c4ca

commit 5f7586197e84caa22013bbdb7bef1f5c5ac6c4ca
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2024-07-16 20:32:19 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-01-17 12:24:51 +0000

    cred: crget(): Compute initial 'cr_agroups' with nitems()
    
    No functional change (intended).
    
    Reviewed by:    mhorne, emaste
    Approved by:    markj (mentor)
    MFC after:      5 days
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D46910
    
    (cherry picked from commit f5b46856918cc6cc3ea49e3ab95163d318563ece)
---
 sys/kern/kern_prot.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c
index 2dc5ecd00175..5fe587bdc421 100644
--- a/sys/kern/kern_prot.c
+++ b/sys/kern/kern_prot.c
@@ -2117,8 +2117,7 @@ crget(void)
 	mac_cred_init(cr);
 #endif
 	cr->cr_groups = cr->cr_smallgroups;
-	cr->cr_agroups =
-	    sizeof(cr->cr_smallgroups) / sizeof(cr->cr_smallgroups[0]);
+	cr->cr_agroups = nitems(cr->cr_smallgroups);
 	return (cr);
 }