Blob Blame History Raw
From: Zhen Lei <thunder.leizhen@huawei.com>
Date: Tue, 24 Nov 2020 18:41:00 +0800
Subject: bpftool: Fix error return value in build_btf_type_table
Patch-mainline: v5.10-rc7
Git-commit: 68878a5c5b852d17f5827ce8a0f6fbd8b4cdfada
References: bsc#1177028

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
Acked-by: Gary Lin <glin@suse.com>
---
 tools/bpf/bpftool/btf.c |    1 +
 1 file changed, 1 insertion(+)

--- a/tools/bpf/bpftool/btf.c
+++ b/tools/bpf/bpftool/btf.c
@@ -693,6 +693,7 @@ build_btf_type_table(struct btf_attach_t
 		obj_node = calloc(1, sizeof(*obj_node));
 		if (!obj_node) {
 			p_err("failed to allocate memory: %s", strerror(errno));
+			err = -ENOMEM;
 			goto err_free;
 		}