sparse complains about missing declarations and a few of them are in another .c file. One has no other declaration because it is used localy and marked weak because it might be defined in another .c file. Move the declarations from bpf_trace.c to a common place and add one for bpf_sk_storage_get_cg_sock_proto. After this change there are only a few missing declartions within the __bpf_kfunc_start_defs() block which explictlty disables this kind of warning for the compiler. I am not aware of something similar for sparse so I guess are stuck with them unless we add them. Cc: Masami Hiramatsu <mhiramat@xxxxxxxxxx> Cc: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx> Cc: Steven Rostedt <rostedt@xxxxxxxxxxx> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> --- include/linux/bpf.h | 5 +++++ kernel/trace/bpf_trace.c | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/linux/bpf.h b/include/linux/bpf.h index f5c6bc9093a6b..d411bf52910cc 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -840,6 +840,11 @@ struct bpf_func_proto { bool (*allowed)(const struct bpf_prog *prog); }; +extern const struct bpf_func_proto bpf_xdp_get_buff_len_trace_proto; +extern const struct bpf_func_proto bpf_skb_output_proto; +extern const struct bpf_func_proto bpf_xdp_output_proto; +extern const struct bpf_func_proto bpf_sk_storage_get_cg_sock_proto; + /* bpf_context is intentionally undefined structure. Pointer to bpf_context is * the first argument to eBPF programs. * For socket filters: 'struct bpf_context *' == 'struct sk_buff *' diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index d1daeab1bbc14..d8d7ee6b06a6f 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -1951,10 +1951,6 @@ static const struct bpf_func_proto bpf_perf_event_output_proto_raw_tp = { .arg5_type = ARG_CONST_SIZE_OR_ZERO, }; -extern const struct bpf_func_proto bpf_skb_output_proto; -extern const struct bpf_func_proto bpf_xdp_output_proto; -extern const struct bpf_func_proto bpf_xdp_get_buff_len_trace_proto; - BPF_CALL_3(bpf_get_stackid_raw_tp, struct bpf_raw_tracepoint_args *, args, struct bpf_map *, map, u64, flags) { -- 2.45.2