From: Martin KaFai Lau Date: Thu, 9 Jan 2020 00:34:59 +0000 (-0800) Subject: bpf: Add enum support to btf_ctx_access() X-Git-Tag: block-5.6-2020-02-05~43^2~46^2~37^2~8 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=218b3f65f9081f5e1bffe6de5f0f4b22c935410b;p=linux-block.git bpf: Add enum support to btf_ctx_access() It allows bpf prog (e.g. tracing) to attach to a kernel function that takes enum argument. Signed-off-by: Martin KaFai Lau Signed-off-by: Alexei Starovoitov Acked-by: Yonghong Song Link: https://lore.kernel.org/bpf/20200109003459.3855366-1-kafai@fb.com --- diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index 497ecf62d79d..6a5ccb748a72 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -3677,7 +3677,7 @@ bool btf_ctx_access(int off, int size, enum bpf_access_type type, /* skip modifiers */ while (btf_type_is_modifier(t)) t = btf_type_by_id(btf, t->type); - if (btf_type_is_int(t)) + if (btf_type_is_int(t) || btf_type_is_enum(t)) /* accessing a scalar */ return true; if (!btf_type_is_ptr(t)) {