public inbox for sched-ext@lists.linux.dev
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Cheng-Yang Chou <yphbchou0911@gmail.com>
Cc: sched-ext@lists.linux.dev, David Vernet <void@manifault.com>,
	Andrea Righi <arighi@nvidia.com>,
	Changwoo Min <changwoo@igalia.com>,
	Ching-Chun Huang <jserv@ccns.ncku.edu.tw>,
	Chia-Ping Tsai <chia7712@gmail.com>
Subject: Re: [PATCH v2 sched_ext/for-7.1] sched_ext: Fix invalid kobj cast in scx_uevent()
Date: Mon, 23 Mar 2026 07:47:56 -1000	[thread overview]
Message-ID: <acF8zKIsBST6Gha_@slm.duckdns.org> (raw)
In-Reply-To: <20260323104848.3879920-1-yphbchou0911@gmail.com>

On Mon, Mar 23, 2026 at 06:48:29PM +0800, Cheng-Yang Chou wrote:
>  static int scx_uevent(const struct kobject *kobj, struct kobj_uevent_env *env)
>  {
> -	const struct scx_sched *sch = container_of(kobj, struct scx_sched, kobj);
> +	const struct scx_sched *sch;
> +
> +	/*
> +	 * scx_uevent() can be reached by both scx_sched kobjects (scx_ktype)
> +	 * and sub-scheduler kset kobjects (kset_ktype) through the parent
> +	 * chain walk. Filter out the latter to avoid invalid casts.
> +	 */
> +	if (kobj->ktype != &scx_ktype)
> +		return 0;
> +
> +	sch = container_of(kobj, struct scx_sched, kobj);

I'll apply as-is but you don't need to move container_of() here. It's just
address calculation, not a dereference.

Thanks.

-- 
tejun

  reply	other threads:[~2026-03-23 17:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-23 10:48 [PATCH v2 sched_ext/for-7.1] sched_ext: Fix invalid kobj cast in scx_uevent() Cheng-Yang Chou
2026-03-23 17:47 ` Tejun Heo [this message]
2026-03-24  9:57   ` Cheng-Yang Chou
2026-03-23 17:54 ` 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=acF8zKIsBST6Gha_@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=arighi@nvidia.com \
    --cc=changwoo@igalia.com \
    --cc=chia7712@gmail.com \
    --cc=jserv@ccns.ncku.edu.tw \
    --cc=sched-ext@lists.linux.dev \
    --cc=void@manifault.com \
    --cc=yphbchou0911@gmail.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