> diff --git a/kernel/bpf/bpf_struct_ops.c b/kernel/bpf/bpf_struct_ops.c
> index 1178acd72296..bf3004908d15 100644
> --- a/kernel/bpf/bpf_struct_ops.c
> +++ b/kernel/bpf/bpf_struct_ops.c
[ ... ]
> diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
> index a6634237dc89..c3c1421208b4 100644
> --- a/kernel/bpf/btf.c
> +++ b/kernel/bpf/btf.c
[ ... ]
> @@ -10135,32 +10150,36 @@ bpf_struct_ops_find(struct btf *btf, u32 type_id)
> return NULL;
> }
>
> -int __register_bpf_struct_ops(struct bpf_struct_ops *st_ops)
> +static int btf_struct_ops_add(struct btf *btf, struct bpf_struct_ops *st_ops)
> {
> struct bpf_verifier_log *log;
> - struct btf *btf;
> - int err = 0;
> -
> - btf = btf_get_module_btf(st_ops->owner);
> - if (!btf)
> - return check_btf_kconfigs(st_ops->owner, "struct_ops");
> - if (IS_ERR(btf))
> - return PTR_ERR(btf);
> + int err;
>
> log = kzalloc_obj(*log, GFP_KERNEL | __GFP_NOWARN);
> - if (!log) {
> - err = -ENOMEM;
> - goto errout;
> - }
> + if (!log)
> + return -ENOMEM;
>
> log->level = BPF_LOG_KERNEL;
>
> err = btf_add_struct_ops(btf, st_ops, log);
This isn't a bug, but btf_struct_ops_add() sits next to the existing
btf_add_struct_ops() that it calls - would a name that does not mirror
the callee, for example btf_register_struct_ops() or
btf_struct_ops_add_locked(), read more clearly here?
The two names differ only in word order, and a reader scanning the file
or grepping has to check which of the two is the wrapper.
>
> -errout:
> kfree(log);
> - btf_put(btf);
> + return err;
> +}
[ ... ]
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/35824427607