public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Masami Hiramatsu <mhiramat@kernel.org>, X86 ML <x86@kernel.org>,
	Ingo Molnar <mingo@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Josh Poimboeuf <jpoimboe@redhat.com>, Daniel Xu <dxu@dxuuu.xyz>,
	linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
	kuba@kernel.org, mingo@redhat.com, ast@kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <bp@alien8.de>,
	Peter Zijlstra <peterz@infradead.org>,
	kernel-team@fb.com, yhs@fb.com, linux-ia64@vger.kernel.org,
	Abhishek Sagar <sagar.abhishek@gmail.com>,
	Andrii Nakryiko <andrii.nakryiko@gmail.com>
Subject: Re: [PATCH -tip 6/6] kprobes: Use bool type for functions which returns boolean value
Date: Sat, 10 Jul 2021 09:27:22 -0700	[thread overview]
Message-ID: <dd3ec20d371703c121a18e91908ab8faa76c852d.camel@perches.com> (raw)
In-Reply-To: <162592897337.1158485.13933847832718343850.stgit@devnote2>

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,



  reply	other threads:[~2021-07-10 16:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-10 14:55 [PATCH -tip 0/6] kprobes: treewide: Clean up kprobe code Masami Hiramatsu
2021-07-10 14:55 ` [PATCH -tip 1/6] kprobes: treewide: Cleanup the error messages for kprobes Masami Hiramatsu
2021-07-10 14:55 ` [PATCH -tip 2/6] kprobes: Fix coding style issues Masami Hiramatsu
2021-07-10 14:55 ` [PATCH -tip 3/6] kprobes: Use IS_ENABLED() instead of kprobes_built_in() Masami Hiramatsu
2021-07-10 14:55 ` [PATCH -tip 4/6] kprobes: Add assertions for required lock Masami Hiramatsu
2021-07-10 14:56 ` [PATCH -tip 5/6] kprobes: treewide: Use 'kprobe_opcode_t *' for the code address in get_optimized_kprobe() Masami Hiramatsu
2021-07-10 14:56 ` [PATCH -tip 6/6] kprobes: Use bool type for functions which returns boolean value Masami Hiramatsu
2021-07-10 16:27   ` Joe Perches [this message]
2021-07-11  1:26     ` Masami Hiramatsu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dd3ec20d371703c121a18e91908ab8faa76c852d.camel@perches.com \
    --to=joe@perches.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=ast@kernel.org \
    --cc=bp@alien8.de \
    --cc=bpf@vger.kernel.org \
    --cc=dxu@dxuuu.xyz \
    --cc=jpoimboe@redhat.com \
    --cc=kernel-team@fb.com \
    --cc=kuba@kernel.org \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=sagar.abhishek@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox