Skip to content

Commit

Permalink
libbpf: Use correct return pointer in attach_raw_tp
Browse files Browse the repository at this point in the history
We need to pass '*link' to final libbpf_get_error,
because that one holds the return value, not 'link'.

Fixes: 4fa5bcf ("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
  • Loading branch information
Jiri Olsa authored and Andrii Nakryiko committed Nov 14, 2022
1 parent ed1fe1b commit 5fd2a60
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/lib/bpf/libbpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 5fd2a60

Please sign in to comment.