From: sashiko-bot@kernel.org
To: "Tao Cui" <cui.tao@linux.dev>
Cc: sched-ext@lists.linux.dev, bpf@vger.kernel.org
Subject: Re: [PATCH 9/9] tools/sched_ext: scx_userland: Reject batch size 0
Date: Tue, 10 Nov 2026 13:01:19 +0000 [thread overview]
Message-ID: <sashiko-outbox-207067@kernel.org> (raw)
In-Reply-To: <20261110125001.4167503-10-cui.tao@linux.dev>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] tools/sched_ext: NULL optarg passed to fprintf() in
pre_bootstrap()
--
commit 0b3057c6e52c8c9370246141c70182a7501b6c0e
Author: Tao Cui <cuitao@kylinos.cn>
tools/sched_ext: scx_userland: Reject batch size 0
This commit rejects a zero batch size in pre_bootstrap() to prevent a
livelock when -b 0 is passed on the command line.
> diff --git a/tools/sched_ext/scx_userland.c b/tools/sched_ext/scx_userland.c
> index b16b6db5f3650..cbd511685449f 100644
> --- a/tools/sched_ext/scx_userland.c
> +++ b/tools/sched_ext/scx_userland.c
> @@ -364,6 +364,11 @@ static void pre_bootstrap(int argc, char **argv)
> }
> }
>
> + if (!batch_size) {
> + fprintf(stderr, "Invalid batch size %s\n", optarg);
> + exit(1);
> + }
[Severity: Low]
Does this pass a NULL optarg to fprintf()? Because this check runs after
the while ((opt = getopt(...)) != -1) loop finishes, the final getopt()
call has already reset optarg to NULL, which prints "(null)" on glibc and
causes a NULL pointer dereference on libcs such as musl. Checking
!batch_size inside case 'b' while optarg still points to the argument (or
printing batch_size with %u) would avoid this.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261110125001.4167503-1-cui.tao@linux.dev?part=9
next prev parent reply other threads:[~2026-11-10 13:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 12:49 [PATCH 0/9] tools/sched_ext: robustness fixes from cold review Tao Cui
2026-11-10 12:49 ` [PATCH 1/9] tools/sched_ext: scx_flatcg: Reset the stats baseline on restart Tao Cui
2026-11-10 12:49 ` [PATCH 2/9] tools/sched_ext: scx_flatcg: Validate the stats interval Tao Cui
2026-11-10 12:49 ` [PATCH 3/9] tools/sched_ext: scx_pair: Don't abort when the dispatching cgroup goes away Tao Cui
2026-11-10 12:59 ` sashiko-bot
2026-11-10 12:49 ` [PATCH 4/9] tools/sched_ext: scx_pair: Don't attach after an interrupted initialization Tao Cui
2026-11-10 12:49 ` [PATCH 5/9] tools/sched_ext: scx_pair: Reset pair_id on restart Tao Cui
2026-11-10 12:49 ` [PATCH 6/9] tools/sched_ext: scx_qmap: Add the missing options to the usage synopsis Tao Cui
2026-11-10 12:49 ` [PATCH 7/9] tools/sched_ext: scx_qmap: Reset the hier stats baseline on restart Tao Cui
2026-11-10 12:50 ` [PATCH 8/9] tools/sched_ext: scx_userland: Check dispatch buffer slots before inserting Tao Cui
2026-11-11 21:05 ` bot+bpf-ci
2026-11-10 12:50 ` [PATCH 9/9] tools/sched_ext: scx_userland: Reject batch size 0 Tao Cui
2026-11-10 13:01 ` sashiko-bot [this message]
2026-11-10 19:17 ` [PATCH 0/9] tools/sched_ext: robustness fixes from cold review Tejun Heo
[not found] ` <CA+XhMqzQXn4r57b+CP-mryhat3rtg3bD2BaRLqjjqwEj1eJ-EA@mail.gmail.com>
2026-11-11 5:17 ` Tao Cui
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=sashiko-outbox-207067@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=cui.tao@linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sched-ext@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.