BPF List
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Hou Tao <houtao@huaweicloud.com>, bpf@vger.kernel.org
Cc: Martin KaFai Lau <martin.lau@linux.dev>,
	Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	Andrii Nakryiko <andrii@kernel.org>, Song Liu <song@kernel.org>,
	Hao Luo <haoluo@google.com>,
	Yonghong Song <yonghong.song@linux.dev>,
	Daniel Borkmann <daniel@iogearbox.net>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>,
	Jiri Olsa <jolsa@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	Kui-Feng Lee <thinker.li@gmail.com>,
	houtao1@huawei.com, xukuohai@huawei.com
Subject: Re: [PATCH bpf RESEND 1/2] bpf: Check the remaining info_cnt before repeating btf fields
Date: Wed, 09 Oct 2024 00:26:38 -0700	[thread overview]
Message-ID: <8f03efea7c8ca6eeffb3c9310a98c01fcf04c95f.camel@gmail.com> (raw)
In-Reply-To: <eeceba84-0fa0-322a-5236-0f02103f4863@huaweicloud.com>

On Wed, 2024-10-09 at 15:12 +0800, Hou Tao wrote:

[...]

> I don't think they are the same. The main reason is due to the check in
> the beginning of btf_repeat_field():
> 
>         /* Ensure not repeating fields that should not be repeated. */
>         for (i = 0; i < field_cnt; i++) {
>                 switch (info[i].type) {
> 
> There are two cases here:
> 1) info_cnt == 0
> Because info_cnt is 0, the found record isn't saved in info[0], the
> check will be incorrect
> 
> 2) nelements ==1 && info_cnt > 0
> If the found record is bpf_timer or similar, btf_repeat_fields() will
> return -EINVAL instead of 0.

Oh, right, there is a loop accessing 'info' at the start.
Sorry for the noise.


  reply	other threads:[~2024-10-09  7:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-08  7:11 [PATCH bpf RESEND 0/2] Check the remaining info_cnt before repeating btf fields Hou Tao
2024-10-08  7:11 ` [PATCH bpf RESEND 1/2] bpf: " Hou Tao
2024-10-09  6:42   ` Eduard Zingerman
2024-10-09  7:12     ` Hou Tao
2024-10-09  7:26       ` Eduard Zingerman [this message]
2024-10-08  7:11 ` [PATCH bpf RESEND 2/2] selftests/bpf: Add more test case for field flattening Hou Tao
2024-10-09  7:29   ` Eduard Zingerman
2024-10-09 23:50 ` [PATCH bpf RESEND 0/2] Check the remaining info_cnt before repeating btf fields patchwork-bot+netdevbpf

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=8f03efea7c8ca6eeffb3c9310a98c01fcf04c95f.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=houtao1@huawei.com \
    --cc=houtao@huaweicloud.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=thinker.li@gmail.com \
    --cc=xukuohai@huawei.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