From: Alan Maguire Date: Sat, 29 Jun 2024 10:00:58 +0000 (+0100) Subject: libbpf: Fix error handling in btf__distill_base() X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=5b747c23f17d791e08fdf4baa7e14b704625518c;p=linux-2.6-microblaze.git libbpf: Fix error handling in btf__distill_base() Coverity points out that after calling btf__new_empty_split() the wrong value is checked for error. Fixes: 58e185a0dc35 ("libbpf: Add btf__distill_base() creating split BTF with distilled base BTF") Reported-by: Andrii Nakryiko Signed-off-by: Alan Maguire Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20240629100058.2866763-1-alan.maguire@oracle.com --- diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c index cd5dd6619214..32c00db3b91b 100644 --- a/tools/lib/bpf/btf.c +++ b/tools/lib/bpf/btf.c @@ -5431,7 +5431,7 @@ int btf__distill_base(const struct btf *src_btf, struct btf **new_base_btf, * BTF available. */ new_split = btf__new_empty_split(new_base); - if (!new_split_btf) { + if (!new_split) { err = -errno; goto done; }