linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] tools/bpftool: fix error return value in build_btf_type_table()
@ 2020-11-24 10:41 Zhen Lei
  2020-11-24 16:00 ` Yonghong Song
  2020-11-24 22:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Zhen Lei @ 2020-11-24 10:41 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, netdev, bpf, linux-kernel
  Cc: Zhen Lei

An appropriate return value should be set on the failed path.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 tools/bpf/bpftool/btf.c | 1 +
 1 file changed, 1 insertion(+)

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;
 		}
 
-- 
2.26.0.106.g9fadedd



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] tools/bpftool: fix error return value in build_btf_type_table()
  2020-11-24 10:41 [PATCH 1/1] tools/bpftool: fix error return value in build_btf_type_table() Zhen Lei
@ 2020-11-24 16:00 ` Yonghong Song
  2020-11-24 22:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Yonghong Song @ 2020-11-24 16:00 UTC (permalink / raw)
  To: Zhen Lei, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, John Fastabend, KP Singh, netdev,
	bpf, linux-kernel



On 11/24/20 2:41 AM, Zhen Lei wrote:
> An appropriate return value should be set on the failed path.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>

LGTM.

Acked-by: Yonghong Song <yhs@fb.com>

Also this is a bug fix. It should probably be targeted to bpf tree. So,

Fixes: 4d374ba0bf30 ("tools: bpftool: implement "bpftool btf show|list"")

> ---
>   tools/bpf/bpftool/btf.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> 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;
>   		}
>   
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] tools/bpftool: fix error return value in build_btf_type_table()
  2020-11-24 10:41 [PATCH 1/1] tools/bpftool: fix error return value in build_btf_type_table() Zhen Lei
  2020-11-24 16:00 ` Yonghong Song
@ 2020-11-24 22:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2020-11-24 22:30 UTC (permalink / raw)
  To: Leizhen
  Cc: ast, daniel, andrii, kafai, songliubraving, yhs, john.fastabend,
	kpsingh, netdev, bpf, linux-kernel

Hello:

This patch was applied to bpf/bpf.git (refs/heads/master):

On Tue, 24 Nov 2020 18:41:00 +0800 you wrote:
> An appropriate return value should be set on the failed path.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> ---
>  tools/bpf/bpftool/btf.c | 1 +
>  1 file changed, 1 insertion(+)

Here is the summary with links:
  - [1/1] tools/bpftool: fix error return value in build_btf_type_table()
    https://git.kernel.org/bpf/bpf/c/68878a5c5b85

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-24 22:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-24 10:41 [PATCH 1/1] tools/bpftool: fix error return value in build_btf_type_table() Zhen Lei
2020-11-24 16:00 ` Yonghong Song
2020-11-24 22:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).