From: David Carlier Date: Wed, 11 Feb 2026 21:52:13 +0000 (+0000) Subject: tools/sched_ext: scx_flatcg: zero-initialize stats counter array X-Git-Tag: v7.0-rc1~21^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11fece49e956ef97318177f5af15a84317594244;p=thirdparty%2Flinux.git tools/sched_ext: scx_flatcg: zero-initialize stats counter array The local cnts array in read_stats() is not initialized before being accumulated into per-CPU stats, which may lead to reading garbage values. Zero it out with memset alongside the existing stats array initialization. Signed-off-by: David Carlier Signed-off-by: Tejun Heo --- diff --git a/tools/sched_ext/scx_flatcg.c b/tools/sched_ext/scx_flatcg.c index cd85eb4011793..bea76d0602014 100644 --- a/tools/sched_ext/scx_flatcg.c +++ b/tools/sched_ext/scx_flatcg.c @@ -106,6 +106,7 @@ static void fcg_read_stats(struct scx_flatcg *skel, __u64 *stats) __u32 idx; memset(stats, 0, sizeof(stats[0]) * FCG_NR_STATS); + memset(cnts, 0, sizeof(cnts)); for (idx = 0; idx < FCG_NR_STATS; idx++) { int ret, cpu;