lkml.org 
[lkml]   [2018]   [May]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/8] signal: make may_ptrace_stop() return bool
On Mon, May 28, 2018 at 03:49:11PM +0200, Christian Brauner wrote:
> may_ptrace_stop() already behaves like a boolean function. Let's actually
> declare it as such too.
>
> Signed-off-by: Christian Brauner <christian@brauner.io>
> ---
> kernel/signal.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/signal.c b/kernel/signal.c
> index 81be01d193f4..6c2e7b45cba1 100644
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -1889,10 +1889,10 @@ static void do_notify_parent_cldstop(struct task_struct *tsk,
> spin_unlock_irqrestore(&sighand->siglock, flags);
> }
>
> -static inline int may_ptrace_stop(void)
> +static inline bool may_ptrace_stop(void)
> {
> if (!likely(current->ptrace))
> - return 0;
> + return false;
> /*
> * Are we in the middle of do_coredump?
> * If so and our tracer is also part of the coredump stopping
> @@ -1908,9 +1908,9 @@ static inline int may_ptrace_stop(void)
> */
> if (unlikely(current->mm->core_state) &&
> unlikely(current->mm == current->parent->mm))
> - return 0;
> + return false;
>
> - return 1;
> + return true;

return !current->mm->core_state || current->mm != current->parent->mm;

or, if it gives any measurably better code generation,

return likely(!current->mm->core_state ||
current->mm != current->parent->mm);

\
 
 \ /
  Last update: 2018-05-28 16:12    [W:0.152 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site