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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dd3ec20d371703c121a18e91908ab8faa76c852d.camel@perches.com>
Date:   Sat, 10 Jul 2021 09:27:22 -0700
From:   Joe Perches <joe@...ches.com>
To:     Masami Hiramatsu <mhiramat@...nel.org>, X86 ML <x86@...nel.org>,
        Ingo Molnar <mingo@...nel.org>
Cc:     Steven Rostedt <rostedt@...dmis.org>,
        Josh Poimboeuf <jpoimboe@...hat.com>,
        Daniel Xu <dxu@...uu.xyz>, linux-kernel@...r.kernel.org,
        bpf@...r.kernel.org, kuba@...nel.org, mingo@...hat.com,
        ast@...nel.org, Thomas Gleixner <tglx@...utronix.de>,
        Borislav Petkov <bp@...en8.de>,
        Peter Zijlstra <peterz@...radead.org>, kernel-team@...com,
        yhs@...com, linux-ia64@...r.kernel.org,
        Abhishek Sagar <sagar.abhishek@...il.com>,
        Andrii Nakryiko <andrii.nakryiko@...il.com>
Subject: Re: [PATCH -tip 6/6] kprobes: Use bool type for functions which
 returns boolean value

On Sat, 2021-07-10 at 23:56 +0900, Masami Hiramatsu wrote:
> Use the 'bool' type instead of 'int' for the functions which
> returns a boolean value, because this makes clear that those
> functions don't return any error code.
[]
> diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
[]
> @@ -104,25 +104,25 @@ struct kprobe {
>  #define KPROBE_FLAG_FTRACE	8 /* probe is using ftrace */
>  
> 
>  /* Has this kprobe gone ? */
> -static inline int kprobe_gone(struct kprobe *p)
> +static inline bool kprobe_gone(struct kprobe *p)
>  {
>  	return p->flags & KPROBE_FLAG_GONE;
>  }

This change would also allow the removal of the !! from:

kernel/trace/trace_kprobe.c:104:        return !!(kprobe_gone(&tk->rp.kp));
---
 kernel/trace/trace_kprobe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index ea6178cb5e334..c6e0345a44e94 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -101,7 +101,7 @@ static nokprobe_inline unsigned long trace_kprobe_offset(struct trace_kprobe *tk
 
 static nokprobe_inline bool trace_kprobe_has_gone(struct trace_kprobe *tk)
 {
-	return !!(kprobe_gone(&tk->rp.kp));
+	return kprobe_gone(&tk->rp.kp);
 }
 
 static nokprobe_inline bool trace_kprobe_within_module(struct trace_kprobe *tk,


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ