From: Zhen Lei Date: Tue, 24 Nov 2020 10:41:00 +0000 (+0800) Subject: bpftool: Fix error return value in build_btf_type_table X-Git-Tag: v5.10-rc7~20^2~27^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=68878a5c5b852d17f5827ce8a0f6fbd8b4cdfada;p=thirdparty%2Fkernel%2Flinux.git 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 Signed-off-by: Zhen Lei Signed-off-by: Daniel Borkmann Acked-by: Yonghong Song Link: https://lore.kernel.org/bpf/20201124104100.491-1-thunder.leizhen@huawei.com --- diff --git a/tools/bpf/bpftool/btf.c b/tools/bpf/bpftool/btf.c index 8ab142ff5eac5..2afb7d5b1aca2 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; }