]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
bpf: Move btf_type_is_struct_ptr() under CONFIG_BPF_SYSCALL
authorAlistair Francis <alistair23@gmail.com>
Mon, 4 Nov 2024 06:03:00 +0000 (16:03 +1000)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 4 Nov 2024 18:00:39 +0000 (10:00 -0800)
The static inline btf_type_is_struct_ptr() function calls
btf_type_skip_modifiers() which is guarded by CONFIG_BPF_SYSCALL.
btf_type_is_struct_ptr() is also only called by CONFIG_BPF_SYSCALL
ifdef code, so let's only expose btf_type_is_struct_ptr() if
CONFIG_BPF_SYSCALL is defined.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Link: https://lore.kernel.org/r/20241104060300.421403-1-alistair.francis@wdc.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/btf.h

index 631060e3ad146427955d83f0ecfca1423d4d0803..4214e76c916861462e45e98690fcf461c05ca737 100644 (file)
@@ -582,6 +582,16 @@ int get_kern_ctx_btf_id(struct bpf_verifier_log *log, enum bpf_prog_type prog_ty
 bool btf_types_are_same(const struct btf *btf1, u32 id1,
                        const struct btf *btf2, u32 id2);
 int btf_check_iter_arg(struct btf *btf, const struct btf_type *func, int arg_idx);
+
+static inline bool btf_type_is_struct_ptr(struct btf *btf, const struct btf_type *t)
+{
+       if (!btf_type_is_ptr(t))
+               return false;
+
+       t = btf_type_skip_modifiers(btf, t->type, NULL);
+
+       return btf_type_is_struct(t);
+}
 #else
 static inline const struct btf_type *btf_type_by_id(const struct btf *btf,
                                                    u32 type_id)
@@ -661,15 +671,4 @@ static inline int btf_check_iter_arg(struct btf *btf, const struct btf_type *fun
        return -EOPNOTSUPP;
 }
 #endif
-
-static inline bool btf_type_is_struct_ptr(struct btf *btf, const struct btf_type *t)
-{
-       if (!btf_type_is_ptr(t))
-               return false;
-
-       t = btf_type_skip_modifiers(btf, t->type, NULL);
-
-       return btf_type_is_struct(t);
-}
-
 #endif