mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrea Righi <arighi@nvidia.com>
To: guanjing <guanjing@cmss.chinamobile.com>
Cc: tj@kernel.org, void@manifault.com, joshdon@google.com,
	haoluo@google.com, brho@google.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] sched_ext: fix application of sizeof to pointer
Date: Wed, 20 Nov 2024 14:59:31 +0100	[thread overview]
Message-ID: <Zz3rQ3SoxPr4h_vV@gpd3> (raw)
In-Reply-To: <20241117025129.159014-1-guanjing@cmss.chinamobile.com>

On Sun, Nov 17, 2024 at 10:51:29AM +0800, guanjing wrote:
> 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>

Thanks for catching this, it looks good to me.

Could you send a PR for https://github.com/sched-ext/scx? We usually
sync the C schedulers from this repository into the kernel.

If you want you can add my:

Acked-by: Andrea Righi <arighi@nvidia.com>

Thanks,
-Andrea

> ---
>  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
> 
> 
> 

  reply	other threads:[~2024-11-20 13:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-17  2:51 guanjing
2024-11-20 13:59 ` Andrea Righi [this message]
2024-12-04 19:48 ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zz3rQ3SoxPr4h_vV@gpd3 \
    --to=arighi@nvidia.com \
    --cc=brho@google.com \
    --cc=guanjing@cmss.chinamobile.com \
    --cc=haoluo@google.com \
    --cc=joshdon@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=void@manifault.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®