diff mbox series

libbpf: Fix error path in bpf_object__elf_init()

Message ID 20210317145414.884817-1-namhyung@kernel.org (mailing list archive)
State Accepted
Commit 8f3f5792f2940c16ab63c614b26494c8689c9c1e
Delegated to: BPF
Headers show
Series libbpf: Fix error path in bpf_object__elf_init() | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Namhyung Kim March 17, 2021, 2:54 p.m. UTC
When it failed to get section names, it should call
bpf_object__elf_finish() like others.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/lib/bpf/libbpf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

patchwork-bot+netdevbpf@kernel.org March 17, 2021, 11:50 p.m. UTC | #1
Hello:

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

On Wed, 17 Mar 2021 23:54:14 +0900 you wrote:
> When it failed to get section names, it should call
> bpf_object__elf_finish() like others.
> 
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/lib/bpf/libbpf.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Here is the summary with links:
  - libbpf: Fix error path in bpf_object__elf_init()
    https://git.kernel.org/bpf/bpf/c/8f3f5792f294

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

Patch

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 2f351d3ad3e7..8d610259f4be 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -1194,7 +1194,8 @@  static int bpf_object__elf_init(struct bpf_object *obj)
 	if (!elf_rawdata(elf_getscn(obj->efile.elf, obj->efile.shstrndx), NULL)) {
 		pr_warn("elf: failed to get section names strings from %s: %s\n",
 			obj->path, elf_errmsg(-1));
-		return -LIBBPF_ERRNO__FORMAT;
+		err = -LIBBPF_ERRNO__FORMAT;
+		goto errout;
 	}
 
 	/* Old LLVM set e_machine to EM_NONE */