Re: [PATCH bpf-next 2/9] bpf: Move func_models from bpf_struct_ops to bpf_struct_ops_desc

From
Alexei Starovoitov <hidden>
Date
2024-11-28 02:43:42
Also in
bpf, linux-input, lkml
Reply to
Thomas Weißschuh, 2024-11-27
On Wed, Nov 27, 2024 at 11:20 AM Thomas Weißschuh [off-list ref] wrote:
quoted hunk ↗ jump to hunk
--- a/net/bpf/bpf_dummy_struct_ops.c
+++ b/net/bpf/bpf_dummy_struct_ops.c
@@ -129,7 +129,7 @@ extern const struct bpf_link_ops bpf_struct_ops_link_lops;
 int bpf_struct_ops_test_run(struct bpf_prog *prog, const union bpf_attr *kattr,
                            union bpf_attr __user *uattr)
 {
-       const struct bpf_struct_ops *st_ops = &bpf_bpf_dummy_ops;
+       static typeof_member(struct bpf_struct_ops_desc, func_models) func_models;
        const struct btf_type *func_proto;
        struct bpf_dummy_ops_test_args *args;
        struct bpf_tramp_links *tlinks = NULL;
@@ -175,7 +175,7 @@ int bpf_struct_ops_test_run(struct bpf_prog *prog, const union bpf_attr *kattr,

        op_idx = prog->expected_attach_type;
        err = bpf_struct_ops_prepare_trampoline(tlinks, link,
-                                               &st_ops->func_models[op_idx],
+                                               &func_models[op_idx],
This is sad. You didn't bother running the tests.
Above is producing garbage.
That's why so many BPF CI tests are failing.

Overall I think it's a minimal positive value to constify struct_ops.
Unless other bpf developers see a huge value
I'd prefer to keep the code as-is.

pw-bot: cr
Thread (11 messages) 11 messages, 2 authors, last reply 2024-11-28
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help