Re: [PATCH v3 bpf-next 2/6] libbpf: Adjust btf_vlen() to return a __u32

Alexei Starovoitov
2026-04-20T15:39:11Z

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?