public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Alan Maguire" <alan.maguire@oracle.com>, <sashiko@lists.linux.dev>
Cc: <bpf@vger.kernel.org>
Subject: Re: [PATCH v3 bpf-next 2/6] libbpf: Adjust btf_vlen() to return a __u32
Date: Mon, 20 Apr 2026 08:39:08 -0700	[thread overview]
Message-ID: <DHY3FCU01RAG.1AACAGEQVBFCY@gmail.com> (raw)
In-Reply-To: <40708ab6-7a2a-4c7a-8943-88f25c13036c@oracle.com>

On Mon Apr 20, 2026 at 1:02 AM PDT, Alan Maguire wrote:
> -       return sizeof(struct btf_type) + l[kind].info_sz + vlen * l[kind].elem_sz;
> +       type_size = sizeof(struct btf_type) + l[kind].info_sz + vlen * l[kind].elem_sz;
> +       if ((size_t)type_size > (size_t)(end_type - (const void *)t)) {
> +               pr_debug("Overflow in type size %d for kind %u\n",
> +                        type_size, kind);
> +               return -EINVAL;
> +       }
> +       return type_size;
>  }
>
> Given that this problem exists separate from the extended vlen series, might make more
> sense to send a separate patch targeting the bpf tree for this issue.

Make sense to me. Use check_add_overflow() when you do.
Are you still planning to respin the set ? or is it good to go?


  reply	other threads:[~2026-04-20 15:39 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-17 14:30 [PATCH v3 bpf-next 0/6] bpf: Extend BTF UAPI vlen, kinds to use unused bits Alan Maguire
2026-04-17 14:30 ` [PATCH v3 bpf-next 1/6] " Alan Maguire
2026-04-17 18:11   ` Mykyta Yatsenko
2026-04-17 14:30 ` [PATCH v3 bpf-next 2/6] libbpf: Adjust btf_vlen() to return a __u32 Alan Maguire
2026-04-17 17:07   ` sashiko-bot
2026-04-20  8:02     ` Alan Maguire
2026-04-20 15:39       ` Alexei Starovoitov [this message]
2026-04-20 16:07         ` Alan Maguire
2026-04-17 18:26   ` Mykyta Yatsenko
2026-04-17 14:30 ` [PATCH v3 bpf-next 3/6] bpftool: Support 24-bit vlen Alan Maguire
2026-04-17 18:36   ` Mykyta Yatsenko
2026-04-17 14:30 ` [PATCH v3 bpf-next 4/6] selftests/bpf: Fix up btf/invalid test for extended kind Alan Maguire
2026-04-17 19:07   ` Mykyta Yatsenko
2026-04-17 14:30 ` [PATCH v3 bpf-next 5/6] selftests/bpf: Fix up __u16 vlen assumptions Alan Maguire
2026-04-17 19:06   ` Mykyta Yatsenko
2026-04-17 14:30 ` [PATCH v3 bpf-next 6/6] Documentation/bpf: Update btf doc with updated vlen, kind sizes Alan Maguire
2026-04-17 15:39   ` bot+bpf-ci
2026-04-20  8:09     ` Alan Maguire
2026-04-20 11:48       ` Mykyta Yatsenko
2026-04-20 18:30 ` [PATCH v3 bpf-next 0/6] bpf: Extend BTF UAPI vlen, kinds to use unused bits David Faust
2026-04-20 19:24   ` Alan Maguire
2026-04-21  1:00 ` 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=DHY3FCU01RAG.1AACAGEQVBFCY@gmail.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=alan.maguire@oracle.com \
    --cc=bpf@vger.kernel.org \
    --cc=sashiko@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