All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next] libbpf: Remove redundant check in btf_fixup_datasec()
@ 2022-02-20  7:27 Yuntao Wang
  2022-02-20 20:15 ` Andrii Nakryiko
  2022-02-22 22:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 5+ messages in thread
From: Yuntao Wang @ 2022-02-20  7:27 UTC (permalink / raw)
  To: bpf
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Yuntao Wang

The check 't->size && t->size != size' is redundant because if t->size
compares unequal to 0, we will just skip straight to sorting variables.

Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
---
 tools/lib/bpf/libbpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index ad43b6ce825e..7e978feaf822 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -2795,7 +2795,7 @@ static int btf_fixup_datasec(struct bpf_object *obj, struct btf *btf,
 		goto sort_vars;
 
 	ret = find_elf_sec_sz(obj, name, &size);
-	if (ret || !size || (t->size && t->size != size)) {
+	if (ret || !size) {
 		pr_debug("Invalid size for section %s: %u bytes\n", name, size);
 		return -ENOENT;
 	}
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH bpf-next] libbpf: Remove redundant check in btf_fixup_datasec()
  2022-02-20  7:27 [PATCH bpf-next] libbpf: Remove redundant check in btf_fixup_datasec() Yuntao Wang
@ 2022-02-20 20:15 ` Andrii Nakryiko
  2022-02-20 20:19   ` Andrii Nakryiko
  2022-02-22 22:40 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 5+ messages in thread
From: Andrii Nakryiko @ 2022-02-20 20:15 UTC (permalink / raw)
  To: Yuntao Wang
  Cc: bpf, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh

On Sat, Feb 19, 2022 at 11:29 PM Yuntao Wang <ytcoode@gmail.com> wrote:
>
> The check 't->size && t->size != size' is redundant because if t->size
> compares unequal to 0, we will just skip straight to sorting variables.
>
> Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
> ---
>  tools/lib/bpf/libbpf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index ad43b6ce825e..7e978feaf822 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -2795,7 +2795,7 @@ static int btf_fixup_datasec(struct bpf_object *obj, struct btf *btf,
>                 goto sort_vars;
>
>         ret = find_elf_sec_sz(obj, name, &size);
> -       if (ret || !size || (t->size && t->size != size)) {

t->size check is redundant, but  (t->size != size) is not

> +       if (ret || !size) {
>                 pr_debug("Invalid size for section %s: %u bytes\n", name, size);
>                 return -ENOENT;
>         }
> --
> 2.35.1
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH bpf-next] libbpf: Remove redundant check in btf_fixup_datasec()
  2022-02-20 20:15 ` Andrii Nakryiko
@ 2022-02-20 20:19   ` Andrii Nakryiko
  2022-02-21 16:22     ` Yuntao Wang
  0 siblings, 1 reply; 5+ messages in thread
From: Andrii Nakryiko @ 2022-02-20 20:19 UTC (permalink / raw)
  To: Yuntao Wang
  Cc: bpf, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh

On Sun, Feb 20, 2022 at 12:15 PM Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Sat, Feb 19, 2022 at 11:29 PM Yuntao Wang <ytcoode@gmail.com> wrote:
> >
> > The check 't->size && t->size != size' is redundant because if t->size
> > compares unequal to 0, we will just skip straight to sorting variables.
> >
> > Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
> > ---
> >  tools/lib/bpf/libbpf.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> > index ad43b6ce825e..7e978feaf822 100644
> > --- a/tools/lib/bpf/libbpf.c
> > +++ b/tools/lib/bpf/libbpf.c
> > @@ -2795,7 +2795,7 @@ static int btf_fixup_datasec(struct bpf_object *obj, struct btf *btf,
> >                 goto sort_vars;
> >
> >         ret = find_elf_sec_sz(obj, name, &size);
> > -       if (ret || !size || (t->size && t->size != size)) {
>
> t->size check is redundant, but  (t->size != size) is not

ah, never mind :) applied to bpf-next

>
> > +       if (ret || !size) {
> >                 pr_debug("Invalid size for section %s: %u bytes\n", name, size);
> >                 return -ENOENT;
> >         }
> > --
> > 2.35.1
> >

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH bpf-next] libbpf: Remove redundant check in btf_fixup_datasec()
  2022-02-20 20:19   ` Andrii Nakryiko
@ 2022-02-21 16:22     ` Yuntao Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Yuntao Wang @ 2022-02-21 16:22 UTC (permalink / raw)
  To: andrii.nakryiko
  Cc: andrii, ast, bpf, daniel, john.fastabend, kafai, kpsingh,
	songliubraving, yhs, ytcoode

On Sun, Feb 20, 2022 at 12:19 PM Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Sun, Feb 20, 2022 at 12:15 PM Andrii Nakryiko
> <andrii.nakryiko@gmail.com> wrote:
>
> > On Sat, Feb 19, 2022 at 11:29 PM Yuntao Wang <ytcoode@gmail.com> wrote:
> > >
> > > The check 't->size && t->size != size' is redundant because if t->size
> > > compares unequal to 0, we will just skip straight to sorting variables.
> > >
> > > Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
> > > ---
> > >  tools/lib/bpf/libbpf.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> > > index ad43b6ce825e..7e978feaf822 100644
> > > --- a/tools/lib/bpf/libbpf.c
> > > +++ b/tools/lib/bpf/libbpf.c
> > > @@ -2795,7 +2795,7 @@ static int btf_fixup_datasec(struct bpf_object *obj, struct btf *btf,
> > >                 goto sort_vars;
> > >
> > >         ret = find_elf_sec_sz(obj, name, &size);
> > > -       if (ret || !size || (t->size && t->size != size)) {
> >
> > t->size check is redundant, but  (t->size != size) is not
>
> ah, never mind :) applied to bpf-next
>
> >
> > > +       if (ret || !size) {
> > >                 pr_debug("Invalid size for section %s: %u bytes\n", name, size);
> > >                 return -ENOENT;
> > >         }
> > > --
> > > 2.35.1
> > >

Thanks for your reply.

It seems that the patch has not been applied to bpf-next yet,
I can't find it in the commits on the master branch.

Is there anything else I need to do?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH bpf-next] libbpf: Remove redundant check in btf_fixup_datasec()
  2022-02-20  7:27 [PATCH bpf-next] libbpf: Remove redundant check in btf_fixup_datasec() Yuntao Wang
  2022-02-20 20:15 ` Andrii Nakryiko
@ 2022-02-22 22:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-02-22 22:40 UTC (permalink / raw)
  To: Yuntao Wang
  Cc: bpf, ast, daniel, andrii, kafai, songliubraving, yhs,
	john.fastabend, kpsingh

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:

On Sun, 20 Feb 2022 15:27:50 +0800 you wrote:
> The check 't->size && t->size != size' is redundant because if t->size
> compares unequal to 0, we will just skip straight to sorting variables.
> 
> Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
> ---
>  tools/lib/bpf/libbpf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
  - [bpf-next] libbpf: Remove redundant check in btf_fixup_datasec()
    https://git.kernel.org/bpf/bpf-next/c/6966d4c4425b

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-02-22 22:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-20  7:27 [PATCH bpf-next] libbpf: Remove redundant check in btf_fixup_datasec() Yuntao Wang
2022-02-20 20:15 ` Andrii Nakryiko
2022-02-20 20:19   ` Andrii Nakryiko
2022-02-21 16:22     ` Yuntao Wang
2022-02-22 22:40 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.