BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ömer Mete Kaya" <omermetekaya0@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next] bpf: Skip redundant destroy_if_dynptr_stack_slot calls in check_stack_write_var_off
Date: Sun, 27 Sep 2026 23:14:37 +0000	[thread overview]
Message-ID: <20260927231438.549B01F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260927230511.417420-1-omermetekaya0@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] bpf: multi-line comment style violation in check_stack_write_var_off()
--

commit 2ecbd1f84931126c23d8e648f52879b6e724f3c6
Author: Ömer Mete Kaya <omermetekaya0@gmail.com>

bpf: Skip redundant destroy_if_dynptr_stack_slot calls in check_stack_write_var_off

This commit optimizes check_stack_write_var_off() by skipping redundant calls
to destroy_if_dynptr_stack_slot(). Since bpf_get_spi() maps 8 consecutive byte
offsets to the same slot index, it avoids repeatedly processing the same slot
when iterating over a variable-offset stack write range.

> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index 03dbc0e003986..ba029d8c34f89 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
[ ... ]
> @@ -3824,9 +3824,13 @@ static int check_stack_write_var_off(struct bpf_verifier_env *env,
>  		writing_zero = true;
>  
>  	for (i = min_off; i < max_off; i++) {
> -		int spi;
> +		int spi = bpf_get_spi(i);
>  
> -		spi = bpf_get_spi(i);
> +		/* bpf_get_spi() maps 8 consecutive byte offsets to the same
> +		 * slot index; skip redundant calls for the same slot.
> +		 */

[Severity: Low]
This isn't a bug, but does this multi-line comment follow the preferred BPF
subsystem style? 

The BPF subsystem explicitly requires multi-line comments to have the opening
'/*' on its own line, with the text starting on the subsequent line.

> +		if (i != min_off && spi == bpf_get_spi(i - 1))
> +			continue;
>  		err = destroy_if_dynptr_stack_slot(env, state, spi);
>  		if (err)
>  			return err;

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

      reply	other threads:[~2026-09-27 23:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-27 23:04 [PATCH bpf-next] bpf: Skip redundant destroy_if_dynptr_stack_slot calls in check_stack_write_var_off Ömer Mete Kaya
2026-09-27 23:14 ` sashiko-bot [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=20260927231438.549B01F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=omermetekaya0@gmail.com \
    --cc=sashiko-reviews@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox