diff mbox series

[bpf-next] bpf: compile out btf_parse_module() if module BTF is not enabled

Message ID 20201111040645.903494-1-andrii@kernel.org (mailing list archive)
State Accepted
Delegated to: BPF
Headers show
Series [bpf-next] bpf: compile out btf_parse_module() if module BTF is not enabled | expand

Checks

Context Check Description
netdev/apply fail Patch does not apply to bpf-next
netdev/tree_selection success Clearly marked for bpf-next

Commit Message

Andrii Nakryiko Nov. 11, 2020, 4:06 a.m. UTC
Make sure btf_parse_module() is compiled out if module BTFs are not enabled.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Fixes: 36e68442d1af ("bpf: Load and verify kernel module BTFs")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 kernel/bpf/btf.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Alexei Starovoitov Nov. 11, 2020, 4:19 a.m. UTC | #1
On Tue, Nov 10, 2020 at 8:07 PM Andrii Nakryiko <andrii@kernel.org> wrote:
>
> Make sure btf_parse_module() is compiled out if module BTFs are not enabled.
>
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Fixes: 36e68442d1af ("bpf: Load and verify kernel module BTFs")
> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>

Applied. Thanks for quick fix.
diff mbox series

Patch

diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 0f1fd2669d69..6b2d508b33d4 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -4478,6 +4478,8 @@  struct btf *btf_parse_vmlinux(void)
 	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 @@  static struct btf *btf_parse_module(const char *module_name, const void *data, u
 	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;