Skip to contentSkip to conversation

libbpf: Use correct return pointer in attach_raw_tp

PATCH Applied Jiri Olsa 2 participants 2 messages Nov 14, 2022

Subsystems (2)
lore
Share & tools
lore

Jiri Olsa

author reviewer
#0 lore raw

PATCH 1/1 libbpf: Use correct return pointer in attach_raw_tp

We need to pass '*link' to final libbpf_get_error, because that one holds the return value, not 'link'.

Fixes 4fa5bcfe07f7 ("libbpf: Allow BPF program auto-attach handlers to bail out")
---
 tools/lib/bpf/libbpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/libbpf.c +1 -1
index 1d263885d635..4a97e3adbe84 100644
@@ -11223,7 +11223,7 @@ static int attach_raw_tp(const struct bpf_program *prog, long cookie, struct bpf
 	}
 
 	*link = bpf_program__attach_raw_tracepoint(prog, tp_name);
-	return libbpf_get_error(link);
+	return libbpf_get_error(*link);
 }
 
 /* Common logic for all BPF program types that attach to a btf_id */
Signature · 1 line
2.38.1
#1 lore raw
This patch was applied to bpf/bpf.git (master) by Andrii Nakryiko <[email protected]>:

Hello:

This patch was applied to bpf/bpf.git (master)
by Andrii Nakryiko <[email protected]>:

Quoted 8 lines · On Mon, 14 Nov 2022 15:52:57 +0100 you wrote:

We need to pass '*link' to final libbpf_get_error, because that one holds the return value, not 'link'.

Fixes 4fa5bcfe07f7 ("libbpf: Allow BPF program auto-attach handlers to bail out")
---
 tools/lib/bpf/libbpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
- [bpf] libbpf: Use correct return pointer in attach_raw_tp

    https://git.kernel.org/bpf/bpf/c/5fd2a60aecf3

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html