* [PATCH] include: btf: Guard inline function with CONFIG_BPF_SYSCALL
@ 2024-11-04 6:03 Alistair Francis
2024-11-04 18:20 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Alistair Francis @ 2024-11-04 6:03 UTC (permalink / raw)
To: linux-kernel, bpf
Cc: jolsa, haoluo, sdf, kpsingh, john.fastabend, yonghong.song,
alistair23, Alistair Francis
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>
---
include/linux/btf.h | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/include/linux/btf.h b/include/linux/btf.h
index b8a583194c4a9..66a816ba4f5d0 100644
--- a/include/linux/btf.h
+++ b/include/linux/btf.h
@@ -581,6 +581,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)
@@ -660,15 +670,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
--
2.47.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] include: btf: Guard inline function with CONFIG_BPF_SYSCALL
2024-11-04 6:03 [PATCH] include: btf: Guard inline function with CONFIG_BPF_SYSCALL Alistair Francis
@ 2024-11-04 18:20 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-11-04 18:20 UTC (permalink / raw)
To: Alistair Francis
Cc: linux-kernel, bpf, jolsa, haoluo, sdf, kpsingh, john.fastabend,
yonghong.song, alistair.francis
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:
On Mon, 4 Nov 2024 16:03:00 +1000 you wrote:
> 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>
>
> [...]
Here is the summary with links:
- include: btf: Guard inline function with CONFIG_BPF_SYSCALL
https://git.kernel.org/bpf/bpf-next/c/9a783139614f
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-04 18:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-04 6:03 [PATCH] include: btf: Guard inline function with CONFIG_BPF_SYSCALL Alistair Francis
2024-11-04 18:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®