Commit 7112d127 authored by Andrii Nakryiko's avatar Andrii Nakryiko Committed by Alexei Starovoitov

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: 36e68442 ("bpf: Load and verify kernel module BTFs")
Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20201111040645.903494-1-andrii@kernel.org
parent 9600d623
...@@ -4478,6 +4478,8 @@ struct btf *btf_parse_vmlinux(void) ...@@ -4478,6 +4478,8 @@ struct btf *btf_parse_vmlinux(void)
return ERR_PTR(err); return ERR_PTR(err);
} }
#ifdef CONFIG_DEBUG_INFO_BTF_MODULES
static struct btf *btf_parse_module(const char *module_name, const void *data, unsigned int data_size) static struct btf *btf_parse_module(const char *module_name, const void *data, unsigned int data_size)
{ {
struct btf_verifier_env *env = NULL; struct btf_verifier_env *env = NULL;
...@@ -4547,6 +4549,8 @@ static struct btf *btf_parse_module(const char *module_name, const void *data, u ...@@ -4547,6 +4549,8 @@ static struct btf *btf_parse_module(const char *module_name, const void *data, u
return ERR_PTR(err); return ERR_PTR(err);
} }
#endif /* CONFIG_DEBUG_INFO_BTF_MODULES */
struct btf *bpf_prog_get_target_btf(const struct bpf_prog *prog) struct btf *bpf_prog_get_target_btf(const struct bpf_prog *prog)
{ {
struct bpf_prog *tgt_prog = prog->aux->dst_prog; struct bpf_prog *tgt_prog = prog->aux->dst_prog;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment