[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241117025129.159014-1-guanjing@cmss.chinamobile.com>
Date: Sun, 17 Nov 2024 10:51:29 +0800
From: guanjing <guanjing@...s.chinamobile.com>
To: tj@...nel.org,
void@...ifault.com,
joshdon@...gle.com,
haoluo@...gle.com,
brho@...gle.com
Cc: linux-kernel@...r.kernel.org,
guanjing <guanjing@...s.chinamobile.com>
Subject: [PATCH v3] sched_ext: fix application of sizeof to pointer
sizeof when applied to a pointer typed expression gives the size of
the pointer.
The proper fix in this particular case is to code sizeof(*cpuset)
instead of sizeof(cpuset).
This issue was detected with the help of Coccinelle.
Fixes: 22a920209ab6 ("sched_ext: Implement tickless support")
Signed-off-by: guanjing <guanjing@...s.chinamobile.com>
---
tools/sched_ext/scx_central.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/sched_ext/scx_central.c b/tools/sched_ext/scx_central.c
index 21deea320bd7..e938156ed0a0 100644
--- a/tools/sched_ext/scx_central.c
+++ b/tools/sched_ext/scx_central.c
@@ -97,7 +97,7 @@ int main(int argc, char **argv)
SCX_BUG_ON(!cpuset, "Failed to allocate cpuset");
CPU_ZERO(cpuset);
CPU_SET(skel->rodata->central_cpu, cpuset);
- SCX_BUG_ON(sched_setaffinity(0, sizeof(cpuset), cpuset),
+ SCX_BUG_ON(sched_setaffinity(0, sizeof(*cpuset), cpuset),
"Failed to affinitize to central CPU %d (max %d)",
skel->rodata->central_cpu, skel->rodata->nr_cpu_ids - 1);
CPU_FREE(cpuset);
--
2.33.0
Powered by blists - more mailing lists