lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aa21b648da9be14019fb78f23325052ec77b2730.camel@gmail.com>
Date: Tue, 16 Dec 2025 18:57:10 -0800
From: Eduard Zingerman <eddyz87@...il.com>
To: Donglin Peng <dolinux.peng@...il.com>
Cc: ast@...nel.org, andrii.nakryiko@...il.com, zhangxiaoqin@...omi.com, 
	ihor.solodrai@...ux.dev, linux-kernel@...r.kernel.org, bpf@...r.kernel.org,
  pengdonglin <pengdonglin@...omi.com>, Alan Maguire
 <alan.maguire@...cle.com>
Subject: Re: [PATCH bpf-next v9 04/10] libbpf: Optimize type lookup with
 binary search for sorted BTF

On Wed, 2025-12-17 at 10:32 +0800, Donglin Peng wrote:

[...]

> > > +             if (unlikely(kind == -1))
> > > +                     return idx;
> > > +
> > > +             t = btf_type_by_id(btf, idx);
> > > +             if (likely(BTF_INFO_KIND(t->info) == kind))
> > > +                     return idx;
> > > +
> > > +             for (idx++; idx <= end_id; idx++) {
> > > +                     t = btf__type_by_id(btf, idx);
> > > +                     tname = btf__str_by_offset(btf, t->name_off);
> > > +                     if (strcmp(tname, type_name) != 0)
> > > +                             return libbpf_err(-ENOENT);
> > > +                     if (btf_kind(t) == kind)
> >                             ^^^^^^^^^^^^^^^^^^^
> >                 Is kind != -1 check missing here?
> 
> The check for kind != -1 is unnecessary here because it has already been
> performed earlier in the logic, after btf_find_by_name_bsearch successfully
> returned a valid idx. In v8, the implementation of btf_find_by_name_bsearch
> was refined for better performance, and when idx > 0, it guarantees that the
> name has been matched.
> 
> Thank you for the review.
> Donglin

Ack, missed that, thank you for explaining.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ