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
| ||
|
Message-ID: <20171227190042.hwxk6ccazdtnob77@ast-mbp> Date: Wed, 27 Dec 2017 11:00:43 -0800 From: Alexei Starovoitov <alexei.starovoitov@...il.com> To: Eric Leblond <eric@...it.org> Cc: netdev@...r.kernel.org, daniel@...earbox.net, linux-kernel@...r.kernel.org Subject: Re: [PATCH 3/4] libbpf: break loop earlier On Wed, Dec 27, 2017 at 07:02:28PM +0100, Eric Leblond wrote: > Get out of the loop when we have a match. > > Signed-off-by: Eric Leblond <eric@...it.org> > --- > tools/lib/bpf/libbpf.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c > index 5fe8aaa2123e..d263748aa341 100644 > --- a/tools/lib/bpf/libbpf.c > +++ b/tools/lib/bpf/libbpf.c > @@ -412,6 +412,7 @@ bpf_object__init_prog_names(struct bpf_object *obj) > prog->section_name); > return -LIBBPF_ERRNO__LIBELF; > } > + break; why this is needed? The top of the loop is: for (si = 0; si < symbols->d_size / sizeof(GElf_Sym) && !name; so as soon as name is found the loop will exit. I agree that the loop structure is non-standard is confusing, but adding break here will make it even more so. If 'break' is added then '&& !name' should be removed.
Powered by blists - more mailing lists