]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
sched_ext: fix application of sizeof to pointer
authorguanjing <guanjing@cmss.chinamobile.com>
Sun, 17 Nov 2024 02:51:29 +0000 (10:51 +0800)
committerTejun Heo <tj@kernel.org>
Wed, 4 Dec 2024 19:47:39 +0000 (09:47 -1000)
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@cmss.chinamobile.com>
Acked-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
tools/sched_ext/scx_central.c

index 21deea320bd7850d6824ad0d2eab6fe3787e0858..e938156ed0a0d0060d12d1be1aed4a524bcf26ea 100644 (file)
@@ -97,7 +97,7 @@ restart:
        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);