Re: [PATCH v2 2/9] bpf/btf: tracing: Move finding func-proto API and getting func-param API to BTF
From: Alexei Starovoitov <hidden>
Date: 2023-07-17 23:51:49
Also in:
bpf, lkml
From: Alexei Starovoitov <hidden>
Date: 2023-07-17 23:51:49
Also in:
bpf, lkml
On Mon, Jul 17, 2023 at 4:46 PM Masami Hiramatsu [off-list ref] wrote:
quoted
quoted
+ * Return NULL if not found, or return -EINVAL if parameter is invalid. + */ +const struct btf_type *btf_find_func_proto(struct btf *btf, const char *func_name) +{ + const struct btf_type *t; + s32 id; + + if (!btf || !func_name) + return ERR_PTR(-EINVAL);
Please remove these checks. We don't do defensive programming in the BPF subsystem. Don't pass NULL pointers to such functions.