> diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c
> index 2be6707e3320..d2933cf77cd3 100644
> --- a/arch/x86/kernel/uprobes.c
> +++ b/arch/x86/kernel/uprobes.c

[ ... ]

> @@ -1111,21 +1051,19 @@ int set_orig_insn(struct arch_uprobe *auprobe, struct 
> vm_area_struct *vma,
>  static int __arch_uprobe_optimize(struct arch_uprobe *auprobe, struct 
> mm_struct *mm,
>                                 unsigned long vaddr)
>  {
> -     struct uprobe_trampoline *tramp;
> -     struct vm_area_struct *vma;
> -     bool new = false;
> -     int err = 0;
> +     struct pt_regs *regs = task_pt_regs(current);
> +     struct vm_area_struct *vma, *tramp;
> +     int ret;
>
> +     if (!user_64bit_mode(regs))
> +             return -EINVAL;
>       vma = find_vma(mm, vaddr);
>       if (!vma)
>               return -EINVAL;
> -     tramp = get_uprobe_trampoline(vaddr, &new);
> -     if (!tramp)
> -             return -EINVAL;
> -     err = swbp_optimize(auprobe, vma, vaddr, tramp->vaddr);
> -     if (WARN_ON_ONCE(err) && new)
> -             destroy_uprobe_trampoline(tramp);
> -     return err;
> +     tramp = get_uprobe_trampoline(mm, vaddr);
> +     if (IS_ERR(tramp))
> +             return PTR_ERR(tramp);
> +     return WARN_ON_ONCE(swbp_optimize(auprobe, vma, vaddr, 
> tramp->vm_start));
>  }

The variable ret is declared but never used in the refactored
__arch_uprobe_optimize(). The old code used err which was assigned and
returned, but the new code returns directly. Should ret be removed to
avoid a compiler warning?


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

Reply via email to