Commit 11fece49 authored by David Carlier's avatar David Carlier Committed by Tejun Heo
Browse files

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: default avatarDavid Carlier <devnexen@gmail.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 37a93dd5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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;