git: b1326edddb30 - main - linux: setgroups16(): Pre-extend the groups array

From: Olivier Certner <olce_at_FreeBSD.org>
Date: Wed, 17 Sep 2025 12:19:10 UTC
The branch main has been updated by olce:

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

commit b1326edddb302a28fc9418ab60df6210513cc07c
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2025-08-28 16:27:30 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-09-17 12:16:05 +0000

    linux: setgroups16(): Pre-extend the groups array
    
    For the size we know we will need in the end.
    
    No functional change (intended).
    
    MFC after:      5 days
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D52279
---
 sys/compat/linux/linux_uid16.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/compat/linux/linux_uid16.c b/sys/compat/linux/linux_uid16.c
index dd681f971746..8ac093e004d0 100644
--- a/sys/compat/linux/linux_uid16.c
+++ b/sys/compat/linux/linux_uid16.c
@@ -102,6 +102,7 @@ linux_setgroups16(struct thread *td, struct linux_setgroups16_args *args)
 	}
 
 	newcred = crget();
+	crextend(newcred, ngrp);
 	p = td->td_proc;
 	PROC_LOCK(p);
 	oldcred = crcopysafe(p, newcred);