Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 May 2023 04:11:00 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: b9ca790637fc - stable/13 - quiesce_cpus(): do not overallocate generation array
Message-ID:  <202305160411.34G4B04U001931@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib:

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

commit b9ca790637fc25b2d2a190cd925ec2e6cb0db683
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-05-05 20:21:38 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-05-16 04:03:37 +0000

    quiesce_cpus(): do not overallocate generation array
    
    (cherry picked from commit ccc6b87b3825a235991d978e43d29431e012461f)
---
 sys/kern/subr_smp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c
index 7b250aeccc56..401d54277669 100644
--- a/sys/kern/subr_smp.c
+++ b/sys/kern/subr_smp.c
@@ -975,7 +975,8 @@ quiesce_cpus(cpuset_t map, const char *wmesg, int prio)
 
 	error = 0;
 	if ((prio & PDROP) == 0) {
-		gen = malloc(sizeof(u_int) * MAXCPU, M_TEMP, M_WAITOK);
+		gen = mallocarray(sizeof(u_int), mp_maxid + 1, M_TEMP,
+		    M_WAITOK);
 		for (cpu = 0; cpu <= mp_maxid; cpu++) {
 			if (!CPU_ISSET(cpu, &map) || CPU_ABSENT(cpu))
 				continue;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202305160411.34G4B04U001931>