[PATCH 2/5] bpf: Move an assignment for the variable “st_map” in bpf_struct_ops_link_create()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxxxxxxxx>
---
 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






[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux