Sched_ext development
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Liang Luo <luoliang@kylinos.cn>
Cc: David Vernet <void@manifault.com>,
	Andrea Righi <arighi@nvidia.com>,
	Changwoo Min <changwoo@igalia.com>,
	sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org,
	Emil Tsalapatis <emil@etsalapatis.com>
Subject: Re: [PATCH] tools/sched_ext: fix getopt() option variable signedness
Date: Mon, 29 Jun 2026 06:43:19 -1000	[thread overview]
Message-ID: <8f08fc8378db251eba97131350553ced@kernel.org> (raw)
In-Reply-To: <20260626095928.2912889-1-luoliang@kylinos.cn>

On Fri, Jun 26, 2026 at 05:59:28PM +0800, Liang Luo wrote:
> Four example schedulers (scx_simple, scx_cpu0, scx_sdt, scx_userland)
> declare the variable that holds getopt()'s return value as __u32.
> getopt() returns int and uses -1 to mark end-of-options; storing that
> sentinel in an unsigned variable turns it into 0xffffffff, and the
> subsequent 'opt != -1' test only happens to keep working because both
> operands of != are promoted to the same 0xffffffff.
>
> Declare the variable as __s32 instead, matching getopt()'s actual
> contract and the style already used in scx_qmap.c (int opt) and
> scx_pair/central/flatcg.c (__s32 opt). This also silences the
> -Wsign-compare warnings emitted for the affected files.
>
> Signed-off-by: Liang Luo <luoliang@kylinos.cn>

Applied to sched_ext/for-7.3.

Thanks.

--
tejun

      reply	other threads:[~2026-06-29 16:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-26  9:59 [PATCH] tools/sched_ext: fix getopt() option variable signedness luoliang
2026-06-29 16:43 ` Tejun Heo [this message]

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=8f08fc8378db251eba97131350553ced@kernel.org \
    --to=tj@kernel.org \
    --cc=arighi@nvidia.com \
    --cc=changwoo@igalia.com \
    --cc=emil@etsalapatis.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luoliang@kylinos.cn \
    --cc=sched-ext@lists.linux.dev \
    --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