[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <25332b926db78702c59e6907462fed547360e6d3.1744169424.git.dxu@dxuuu.xyz>
Date: Tue, 8 Apr 2025 21:33:56 -0600
From: Daniel Xu <dxu@...uu.xyz>
To: andrii@...nel.org,
ast@...nel.org,
daniel@...earbox.net
Cc: john.fastabend@...il.com,
martin.lau@...ux.dev,
eddyz87@...il.com,
song@...nel.org,
yonghong.song@...ux.dev,
kpsingh@...nel.org,
sdf@...ichev.me,
haoluo@...gle.com,
jolsa@...nel.org,
bpf@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [RFC bpf-next 01/13] bpf: Move bpf_prog_ctx_arg_info_init() body into header
In an effort to reduce the amount of external references into
verifier.c, move the body of this function into the header, as it's
quite small.
Signed-off-by: Daniel Xu <dxu@...uu.xyz>
---
include/linux/bpf.h | 12 ++++++++++--
kernel/bpf/verifier.c | 9 ---------
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 3f0cc89c0622..f1c5356dc099 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -28,6 +28,7 @@
#include <linux/btf.h>
#include <linux/rcupdate_trace.h>
#include <linux/static_call.h>
+#include <linux/string.h>
#include <linux/memcontrol.h>
#include <linux/cfi.h>
#include <asm/rqspinlock.h>
@@ -1976,8 +1977,15 @@ static inline void bpf_struct_ops_desc_release(struct bpf_struct_ops_desc *st_op
#endif
-int bpf_prog_ctx_arg_info_init(struct bpf_prog *prog,
- const struct bpf_ctx_arg_aux *info, u32 cnt);
+static inline int bpf_prog_ctx_arg_info_init(struct bpf_prog *prog,
+ const struct bpf_ctx_arg_aux *info,
+ u32 cnt)
+{
+ prog->aux->ctx_arg_info = kmemdup_array(info, cnt, sizeof(*info), GFP_KERNEL);
+ prog->aux->ctx_arg_info_size = cnt;
+
+ return prog->aux->ctx_arg_info ? 0 : -ENOMEM;
+}
#if defined(CONFIG_CGROUP_BPF) && defined(CONFIG_BPF_LSM)
int bpf_trampoline_link_cgroup_shim(struct bpf_prog *prog,
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 54c6953a8b84..4a60e2d7c10f 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -22895,15 +22895,6 @@ static void print_verification_stats(struct bpf_verifier_env *env)
env->peak_states, env->longest_mark_read_walk);
}
-int bpf_prog_ctx_arg_info_init(struct bpf_prog *prog,
- const struct bpf_ctx_arg_aux *info, u32 cnt)
-{
- prog->aux->ctx_arg_info = kmemdup_array(info, cnt, sizeof(*info), GFP_KERNEL);
- prog->aux->ctx_arg_info_size = cnt;
-
- return prog->aux->ctx_arg_info ? 0 : -ENOMEM;
-}
-
static int check_struct_ops_btf_id(struct bpf_verifier_env *env)
{
const struct btf_type *t, *func_proto;
--
2.47.1
Powered by blists - more mailing lists