From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Leblond Subject: Re: [PATCH 3/4] libbpf: break loop earlier Date: Wed, 27 Dec 2017 21:30:45 +0100 Message-ID: <1514406645.31134.29.camel@regit.org> References: <20171227022730.y27gwva2u2ilyrul@ast-mbp> <20171227180229.1926-1-eric@regit.org> <20171227180229.1926-4-eric@regit.org> <20171227190042.hwxk6ccazdtnob77@ast-mbp> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, daniel@iogearbox.net, linux-kernel@vger.kernel.org To: Alexei Starovoitov Return-path: In-Reply-To: <20171227190042.hwxk6ccazdtnob77@ast-mbp> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org Hello, On Wed, 2017-12-27 at 11:00 -0800, Alexei Starovoitov wrote: > 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 > > --- > > 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? It was just cosmetic, no related bug. > 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. OK, I've missed that. Please disregard this patch. BR, -- Eric Leblond