Re: [PATCH bpf-next] libbpf: Remove redundant check in btf_fixup_datasec()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Feb 19, 2022 at 11:29 PM Yuntao Wang <ytcoode@xxxxxxxxx> 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@xxxxxxxxx>
> ---
>  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
>



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux