summaryrefslogtreecommitdiff
path: root/tools/bpf
diff options
context:
space:
mode:
authorZhen Lei <thunder.leizhen@huawei.com>2020-11-24 18:41:00 +0800
committerDaniel Borkmann <daniel@iogearbox.net>2020-11-24 23:19:18 +0100
commit68878a5c5b852d17f5827ce8a0f6fbd8b4cdfada (patch)
tree1cb7e6242871c67d6a3e133701f9d06ed6f8b8b5 /tools/bpf
parent36ccdf85829a7dd6936dba5d02fa50138471f0d3 (diff)
bpftool: Fix error return value in build_btf_type_table
An appropriate return value should be set on the failed path. Fixes: 4d374ba0bf30 ("tools: bpftool: implement "bpftool btf show|list"") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Yonghong Song <yhs@fb.com> Link: https://lore.kernel.org/bpf/20201124104100.491-1-thunder.leizhen@huawei.com
Diffstat (limited to 'tools/bpf')
-rw-r--r--tools/bpf/bpftool/btf.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/bpf/bpftool/btf.c b/tools/bpf/bpftool/btf.c
index 8ab142ff5eac..2afb7d5b1aca 100644
--- a/tools/bpf/bpftool/btf.c
+++ b/tools/bpf/bpftool/btf.c
@@ -693,6 +693,7 @@ build_btf_type_table(struct btf_attach_table *tab, enum bpf_obj_type type,
obj_node = calloc(1, sizeof(*obj_node));
if (!obj_node) {
p_err("failed to allocate memory: %s", strerror(errno));
+ err = -ENOMEM;
goto err_free;
}