[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ed2f5323-390f-4c9d-919d-df43ba1cad2b@web.de>
Date: Sat, 30 Dec 2023 21:08:15 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: bpf@...r.kernel.org, netdev@...r.kernel.org,
kernel-janitors@...r.kernel.org, Alexei Starovoitov <ast@...nel.org>,
Andrii Nakryiko <andrii@...nel.org>, Daniel Borkmann <daniel@...earbox.net>,
Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
John Fastabend <john.fastabend@...il.com>, KP Singh <kpsingh@...nel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>, Song Liu <song@...nel.org>,
Stanislav Fomichev <sdf@...gle.com>, Yonghong Song <yonghong.song@...ux.dev>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH 2/5] bpf: Move an assignment for the variable “st_map” in bpf_struct_ops_link_create()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sat, 30 Dec 2023 19:00:12 +0100
Move one assignment for the variable “st_map” closer to the place
where this pointer is used.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
kernel/bpf/bpf_struct_ops.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/bpf/bpf_struct_ops.c b/kernel/bpf/bpf_struct_ops.c
index b49ea460d616..4133d65c2a28 100644
--- a/kernel/bpf/bpf_struct_ops.c
+++ b/kernel/bpf/bpf_struct_ops.c
@@ -898,8 +898,6 @@ int bpf_struct_ops_link_create(union bpf_attr *attr)
if (IS_ERR(map))
return PTR_ERR(map);
- st_map = (struct bpf_struct_ops_map *)map;
-
if (!bpf_struct_ops_valid_to_reg(map)) {
err = -EINVAL;
goto put_map;
@@ -916,6 +914,7 @@ int bpf_struct_ops_link_create(union bpf_attr *attr)
if (err)
goto err_out;
+ st_map = (struct bpf_struct_ops_map *)map;
err = st_map->st_ops->reg(st_map->kvalue.data);
if (err) {
bpf_link_cleanup(&link_primer);
--
2.43.0
Powered by blists - more mailing lists