From: Andrii Nakryiko Date: Wed, 11 Nov 2020 04:06:45 +0000 (-0800) Subject: bpf: Compile out btf_parse_module() if module BTF is not enabled X-Git-Tag: v5.11-rc1~169^2~259^2~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7112d127984bd7b0c8ded7973b358829f16735f5;p=thirdparty%2Fkernel%2Flinux.git 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: 36e68442d1af ("bpf: Load and verify kernel module BTFs") Reported-by: Stephen Rothwell Signed-off-by: Andrii Nakryiko Signed-off-by: Alexei Starovoitov Link: https://lore.kernel.org/bpf/20201111040645.903494-1-andrii@kernel.org --- diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index 0f1fd2669d697..6b2d508b33d47 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -4478,6 +4478,8 @@ errout: 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) { struct btf_verifier_env *env = NULL; @@ -4547,6 +4549,8 @@ errout: return ERR_PTR(err); } +#endif /* CONFIG_DEBUG_INFO_BTF_MODULES */ + struct btf *bpf_prog_get_target_btf(const struct bpf_prog *prog) { struct bpf_prog *tgt_prog = prog->aux->dst_prog;