lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdURQWHY2hAe+_sA8cVh1ERD4EfvJqg=NZDA0iXW-sBX+A@mail.gmail.com>
Date: Mon, 19 May 2025 10:48:20 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Mike Rapoport <rppt@...nel.org>
Cc: John Paul Adrian Glaubitz <glaubitz@...sik.fu-berlin.de>, Mike Rapoport <rppt@...il.com>, 
	Rich Felker <dalias@...c.org>, Yoshinori Sato <ysato@...rs.sourceforge.jp>, 
	linux-kernel@...r.kernel.org, linux-sh@...r.kernel.org, 
	kernel test robot <lkp@...el.com>
Subject: Re: [PATCH] sh: kprobes: remove unused variables in kprobe_exceptions_notify()

Hi Mike,

On Sat, 17 May 2025 at 11:30, Mike Rapoport <rppt@...nel.org> wrote:
> From: "Mike Rapoport (Microsoft)" <rppt@...nel.org>
>
> kbuild reports the following warning:
>
>    arch/sh/kernel/kprobes.c: In function 'kprobe_exceptions_notify':
> >> arch/sh/kernel/kprobes.c:412:24: warning: variable 'p' set but not used [-Wunused-but-set-variable]
>      412 |         struct kprobe *p = NULL;
>          |                        ^
>
> The variable 'p' is indeed unused since the commit fa5a24b16f94
> ("sh/kprobes: Don't call the ->break_handler() in SH kprobes code")
>
> Remove that variable along with 'kprobe_opcode_t *addr' which also
> becomes unused after 'p' is removed.
>
> Reported-by: kernel test robot <lkp@...el.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202505151341.EuRFR22l-lkp@intel.com/
> Fixes: fa5a24b16f94 ("sh/kprobes: Don't call the ->break_handler() in SH kprobes code")
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@...nel.org>

Thanks for your patch!

"p" and "addr" are definitely unused (besides side-effects?), so
Reviewed-by: Geert Uytterhoeven <geert+renesas@...der.be>

> --- a/arch/sh/kernel/kprobes.c
> +++ b/arch/sh/kernel/kprobes.c
> @@ -404,13 +404,10 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr)
>  int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
>                                        unsigned long val, void *data)
>  {
> -       struct kprobe *p = NULL;
>         struct die_args *args = (struct die_args *)data;
>         int ret = NOTIFY_DONE;
> -       kprobe_opcode_t *addr = NULL;
>         struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
>
> -       addr = (kprobe_opcode_t *) (args->regs->pc);
>         if (val == DIE_TRAP &&
>             args->trapnr == (BREAKPOINT_INSTRUCTION & 0xff)) {
>                 if (!kprobe_running()) {
> @@ -421,7 +418,6 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
>                                 ret = NOTIFY_DONE;
>                         }
>                 } else {
> -                       p = get_kprobe(addr);
>                         if ((kcb->kprobe_status == KPROBE_HIT_SS) ||
>                             (kcb->kprobe_status == KPROBE_REENTER)) {
>                                 if (post_kprobe_handler(args->regs))

I have no idea what this code is supposed to do, and if it actually
works.  Red flags are that the assigned "p" was never used at all
since the inception of this function.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ