Skip to content

Commit 6966d4c

Browse files
ytcoodeanakryiko
authored andcommitted
libbpf: Remove redundant check in btf_fixup_datasec()
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> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20220220072750.209215-1-ytcoode@gmail.com
1 parent 13c6a37 commit 6966d4c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/lib/bpf/libbpf.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2795,7 +2795,7 @@ static int btf_fixup_datasec(struct bpf_object *obj, struct btf *btf,
27952795
goto sort_vars;
27962796

27972797
ret = find_elf_sec_sz(obj, name, &size);
2798-
if (ret || !size || (t->size && t->size != size)) {
2798+
if (ret || !size) {
27992799
pr_debug("Invalid size for section %s: %u bytes\n", name, size);
28002800
return -ENOENT;
28012801
}

0 commit comments

Comments
 (0)