libbpf: Use correct return pointer in attach_raw_tp
authorJiri Olsa <jolsa@kernel.org>
Mon, 14 Nov 2022 14:52:57 +0000 (15:52 +0100)
committerAndrii Nakryiko <andrii@kernel.org>
Mon, 14 Nov 2022 19:36:55 +0000 (11:36 -0800)
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")
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20221114145257.882322-1-jolsa@kernel.org
tools/lib/bpf/libbpf.c

index 184ce16..91b7106 100644 (file)
@@ -11169,7 +11169,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 */