All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sechang Lim" <rhkrqnwk98@gmail.com>, sched-ext@lists.linux.dev
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH] sched_ext: reject oversized dispatch_max_batch
Date: Fri, 20 Nov 2026 06:05:40 +0000	[thread overview]
Message-ID: <sashiko-outbox-224532@kernel.org> (raw)
In-Reply-To: <20261120054913.3795562-1-rhkrqnwk98@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] sched_ext: unbraced variable declaration after case in
  bpf_scx_init_member()
--

commit 5d981e883681165123cef4a6b3bfda42fae9cb16
Author: Sechang Lim <rhkrqnwk98@gmail.com>

sched_ext: reject oversized dispatch_max_batch

This commit validates sched_ext_ops.dispatch_max_batch against
PCPU_MIN_UNIT_SIZE in bpf_scx_init_member() so oversized per-CPU dispatch
buffer allocations are rejected with -E2BIG during struct_ops map updates.

> diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
> index a9e36b5bb0386..1f663a0490068 100644
> --- a/kernel/sched/ext/ext.c
> +++ b/kernel/sched/ext/ext.c
> @@ -9197,9 +9197,14 @@ static int bpf_scx_init_member(const struct btf_type *t,
>  
>  	switch (moff) {
>  	case offsetof(struct sched_ext_ops, dispatch_max_batch):
> -		if (*(u32 *)(udata + moff) > INT_MAX)
> +		u32 batch = *(u32 *)(udata + moff);
> +		u32 nr = batch ?: SCX_DSP_DFL_MAX_BATCH;

[Severity: Low]
Should this case body be wrapped in braces like the rescue_bandwidth_ppt
and rescue_quantum_us cases below?  Under -std=gnu11, declaring a variable
immediately after a case label is a C23 extension that fails to build on
supported GCC versions prior to GCC 11 (and Sparse) with "a label can only
be part of a statement and a declaration is not a statement".

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261120054913.3795562-1-rhkrqnwk98@gmail.com?part=1

  reply	other threads:[~2026-11-20  6:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  5:49 [PATCH] sched_ext: reject oversized dispatch_max_batch Sechang Lim
2026-11-20  6:05 ` sashiko-bot [this message]
2026-11-20  6:26 ` Andrea Righi
2026-11-20  6:44   ` Sechang Lim

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-224532@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=rhkrqnwk98@gmail.com \
    --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.