Skip to content

Commit f24d192

Browse files
guanjinghtejun
authored andcommitted
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: 22a9202 ("sched_ext: Implement tickless support") Signed-off-by: guanjing <guanjing@cmss.chinamobile.com> Acked-by: Andrea Righi <arighi@nvidia.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent ef7009d commit f24d192

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/sched_ext/scx_central.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ int main(int argc, char **argv)
9797
SCX_BUG_ON(!cpuset, "Failed to allocate cpuset");
9898
CPU_ZERO(cpuset);
9999
CPU_SET(skel->rodata->central_cpu, cpuset);
100-
SCX_BUG_ON(sched_setaffinity(0, sizeof(cpuset), cpuset),
100+
SCX_BUG_ON(sched_setaffinity(0, sizeof(*cpuset), cpuset),
101101
"Failed to affinitize to central CPU %d (max %d)",
102102
skel->rodata->central_cpu, skel->rodata->nr_cpu_ids - 1);
103103
CPU_FREE(cpuset);

0 commit comments

Comments
 (0)