Skip to content

Commit 7112d12

Browse files
anakryikoAlexei Starovoitov
authored andcommitted
bpf: Compile out btf_parse_module() if module BTF is not enabled
Make sure btf_parse_module() is compiled out if module BTFs are not enabled. Fixes: 36e6844 ("bpf: Load and verify kernel module BTFs") Reported-by: Stephen Rothwell <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 9600d62 commit 7112d12

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

kernel/bpf/btf.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4478,6 +4478,8 @@ struct btf *btf_parse_vmlinux(void)
44784478
return ERR_PTR(err);
44794479
}
44804480

4481+
#ifdef CONFIG_DEBUG_INFO_BTF_MODULES
4482+
44814483
static struct btf *btf_parse_module(const char *module_name, const void *data, unsigned int data_size)
44824484
{
44834485
struct btf_verifier_env *env = NULL;
@@ -4547,6 +4549,8 @@ static struct btf *btf_parse_module(const char *module_name, const void *data, u
45474549
return ERR_PTR(err);
45484550
}
45494551

4552+
#endif /* CONFIG_DEBUG_INFO_BTF_MODULES */
4553+
45504554
struct btf *bpf_prog_get_target_btf(const struct bpf_prog *prog)
45514555
{
45524556
struct bpf_prog *tgt_prog = prog->aux->dst_prog;

0 commit comments

Comments
 (0)