> diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
> index 50103b3794fb..b97d9f68fc40 100644
> --- a/arch/powerpc/net/bpf_jit_comp.c
> +++ b/arch/powerpc/net/bpf_jit_comp.c

[ ... ]

> @@ -827,14 +827,14 @@ static void bpf_trampoline_restore_args_stack(u32 
> *image, struct codegen_context
>  static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void 
> *rw_image,
>                                        void *rw_image_end, void *ro_image,
>                                        const struct btf_func_model *m, u32 
> flags,
> -                                      struct bpf_tramp_links *tlinks,
> +                                      struct bpf_tramp_nodes *tnodes,
>                                        void *func_addr)
>  {
>       int regs_off, func_meta_off, ip_off, run_ctx_off, retval_off;
>       int nvr_off, alt_lr_off, r4_off = 0;
> -     struct bpf_tramp_links *fmod_ret = &tlinks[BPF_TRAMP_MODIFY_RETURN];
> -     struct bpf_tramp_links *fentry = &tlinks[BPF_TRAMP_FENTRY];
> -     struct bpf_tramp_links *fexit = &tlinks[BPF_TRAMP_FEXIT];
> +     struct bpf_tramp_nodes *fmod_ret = &tnodes[BPF_TRAMP_MODIFY_RETURN];
> +     struct bpf_tramp_nodes *fentry = &tnodes[BPF_TRAMP_FENTRY];
> +     struct bpf_tramp_nodes *fexit = &tnodes[BPF_TRAMP_FEXIT];
>       int i, ret, nr_regs, retaddr_off, bpf_frame_size = 0;
>       struct codegen_context codegen_ctx, *ctx;
>       int cookie_off, cookie_cnt, cookie_ctx_off;
> -     int fsession_cnt = bpf_fsession_cnt(tlinks);
> +     int fsession_cnt = bpf_fsession_cnt(tnodes);
                                            ^^^^^

This line wasn't actually updated in the diff. The parameter was renamed from
tlinks to tnodes, but this call site still references the old name. Does this
compile?

The same issue appears later in the function:

>       cookie_off = bpf_frame_size;
> -     cookie_cnt = bpf_fsession_cookie_cnt(tlinks);
> +     cookie_cnt = bpf_fsession_cookie_cnt(tnodes);
                                              ^^^^^

This line also wasn't updated and still references tlinks.

> @@ -1050,21 +1050,21 @@ static int __arch_prepare_bpf_trampoline(struct 
> bpf_tramp_image *im, void *rw_im
>
>       cookie_ctx_off = (regs_off - cookie_off) / 8;
>
> -     for (i = 0; i < fentry->nr_links; i++) {
> -             if (bpf_prog_calls_session_cookie(fentry->links[i])) {
> +     for (i = 0; i < fentry->nr_nodes; i++)
> +             if (bpf_prog_calls_session_cookie(fentry->nodes[i])) {
>                       u64 meta = func_meta | (cookie_ctx_off << 
> BPF_TRAMP_COOKIE_INDEX_SHIFT);
>
>                       store_func_meta(image, ctx, meta, func_meta_off);
>                       cookie_ctx_off--;
>               }
>
> -             if (invoke_bpf_prog(image, ro_image, ctx, fentry->links[i], 
> regs_off, retval_off,
> +             if (invoke_bpf_prog(image, ro_image, ctx, fentry->nodes[i], 
> regs_off, retval_off,
>                                   run_ctx_off, flags & 
> BPF_TRAMP_F_RET_FENTRY_RET))
>                       return -EINVAL;
>       }

The opening brace after the for-loop was removed but the closing brace at the
end remains. This creates two problems:

First, the for-loop now only controls the inner if statement checking for
session cookies. The invoke_bpf_prog call is no longer inside the loop and
will only execute once (with whatever value i holds after the loop exits),
instead of being called for each fentry node.

Second, the unmatched closing brace at the end creates a syntax error.

The code structure should be:

    for (i = 0; i < fentry->nr_nodes; i++) {
        if (bpf_prog_calls_session_cookie(fentry->nodes[i])) {
            u64 meta = func_meta | (cookie_ctx_off << 
BPF_TRAMP_COOKIE_INDEX_SHIFT);

            store_func_meta(image, ctx, meta, func_meta_off);
            cookie_ctx_off--;
        }

        if (invoke_bpf_prog(image, ro_image, ctx, fentry->nodes[i], regs_off, 
retval_off,
                    run_ctx_off, flags & BPF_TRAMP_F_RET_FENTRY_RET))
            return -EINVAL;
    }

[ ... ]

---
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/24598000047

Reply via email to