public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Leon Hwang <leon.hwang@linux.dev>
To: bot+bpf-ci@kernel.org, phx0fer@gmail.com, bpf@vger.kernel.org
Cc: martin.lau@linux.dev, ast@kernel.org, daniel@iogearbox.net,
	andrii@kernel.org, martin.lau@kernel.org, eddyz87@gmail.com,
	yonghong.song@linux.dev, clm@meta.com, ihor.solodrai@linux.dev
Subject: Re: [PATCH] bpf: btf: reject division by zero in btf_struct_walk for zero-size flex array elements
Date: Mon, 13 Apr 2026 18:23:56 +0800	[thread overview]
Message-ID: <a9392088-c13c-48b7-af34-57294a440a52@linux.dev> (raw)
In-Reply-To: <b33a500484e976977e6b56d0e1fbc6053c8f2723247eb5d890fe4b2be7242fc1@mail.kernel.org>

Hi Dudu,

The "btf:" in the subject should be dropped. "bpf:" is enough.

BTW, a selftest is required to verify the change. If it is a BUG, the
selftest should reproduce it without the fix.

On 13/4/26 17:26, bot+bpf-ci@kernel.org wrote:
>> Fixes: 1dc92851849c ("bpf: kernel side support for BTF Var and DataSec")
[...]
>> diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
>> index a62d78581207..2365d9b1ef27 100644
>> --- a/kernel/bpf/btf.c
>> +++ b/kernel/bpf/btf.c
>> @@ -7152,6 +7152,13 @@ static int btf_struct_walk(struct bpf_verifier_log *log, const struct btf *btf,
>>  		if (!btf_type_is_struct(t))
>>  			goto error;
>>
>> +		/* Zero-size element type (e.g., empty struct) would cause
>> +		 * division by zero below. Reject the access.
>> +		 */
> 
> This isn't a bug, but the BPF subsystem uses the style where the
> opening /* is on its own line for multi-line comments:
> 
>     /*
>      * Zero-size element type (e.g., empty struct) would cause
>      * division by zero below. Reject the access.
>      */
> 

AI review of the comment style is correct.

Thanks,
Leon

>> [...]

  reply	other threads:[~2026-04-13 10:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-13  8:50 [PATCH] bpf: btf: reject division by zero in btf_struct_walk for zero-size flex array elements Dudu Lu
2026-04-13  9:26 ` bot+bpf-ci
2026-04-13 10:23   ` Leon Hwang [this message]
2026-04-13 10:31     ` Leon Hwang
2026-04-13 21:43 ` Eduard Zingerman

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=a9392088-c13c-48b7-af34-57294a440a52@linux.dev \
    --to=leon.hwang@linux.dev \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bot+bpf-ci@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=clm@meta.com \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=martin.lau@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=phx0fer@gmail.com \
    --cc=yonghong.song@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