* [PATCH] tools/sched_ext: scx_nest: zero-initialize stats counter array
@ 2026-02-11 21:52 David Carlier
2026-02-12 17:29 ` Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: David Carlier @ 2026-02-11 21:52 UTC (permalink / raw)
To: Tejun Heo, David Vernet; +Cc: linux-kernel, David Carlier
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 <devnexen@gmail.com>
---
tools/sched_ext/scx_flatcg.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/sched_ext/scx_flatcg.c b/tools/sched_ext/scx_flatcg.c
index cd85eb401179..bea76d060201 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;
--
2.51.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-12 17:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-11 21:52 [PATCH] tools/sched_ext: scx_nest: zero-initialize stats counter array David Carlier
2026-02-12 17:29 ` Tejun Heo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.