mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Christian Brauner <christian@brauner.io>
Cc: linux-kernel@vger.kernel.org, ebiederm@xmission.com,
	gregkh@linuxfoundation.org, mingo@kernel.org,
	james.morris@microsoft.com, keescook@chromium.org,
	peterz@infradead.org, sds@tycho.nsa.gov,
	akpm@linux-foundation.org, oleg@redhat.com
Subject: Re: [PATCH 2/8] signal: make kill_as_cred_perm() return bool
Date: Mon, 28 May 2018 15:07:49 +0100	[thread overview]
Message-ID: <20180528140749.GY30522@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20180528134916.7568-3-christian@brauner.io>

On Mon, May 28, 2018 at 03:49:10PM +0200, Christian Brauner wrote:
> kill_as_cred_perm() 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 | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/signal.c b/kernel/signal.c
> index c756008d589e..81be01d193f4 100644
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -1349,14 +1349,15 @@ static int kill_proc_info(int sig, struct siginfo *info, pid_t pid)
>  	return error;
>  }
>  
> -static int kill_as_cred_perm(const struct cred *cred,
> +static bool kill_as_cred_perm(const struct cred *cred,
>  			     struct task_struct *target)
>  {
>  	const struct cred *pcred = __task_cred(target);
>  	if (!uid_eq(cred->euid, pcred->suid) && !uid_eq(cred->euid, pcred->uid) &&
>  	    !uid_eq(cred->uid,  pcred->suid) && !uid_eq(cred->uid,  pcred->uid))
> -		return 0;
> -	return 1;
> +		return false;
> +
> +	return true;

Ugh...
	if (!foo && !bar && !baz && !quux)
		return false;
	return true;

is a bloody odd way to spell

	return foo || bar || baz || quux;

  reply	other threads:[~2018-05-28 14:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-28 13:49 [PATCH 0/8] signal: refactor some functions Christian Brauner
2018-05-28 13:49 ` [PATCH 1/8] signal: make force_sigsegv() void Christian Brauner
2018-05-28 13:49 ` [PATCH 2/8] signal: make kill_as_cred_perm() return bool Christian Brauner
2018-05-28 14:07   ` Al Viro [this message]
2018-05-28 18:31     ` Christian Brauner
2018-05-28 13:49 ` [PATCH 3/8] signal: make may_ptrace_stop() " Christian Brauner
2018-05-28 14:12   ` Al Viro
2018-05-28 18:30     ` Christian Brauner
2018-05-28 13:49 ` [PATCH 4/8] signal: add copy_pending() helper Christian Brauner
2018-05-28 13:49 ` [PATCH 5/8] signal: flatten do_send_sig_info() Christian Brauner
2018-05-28 14:15   ` Al Viro
2018-05-28 15:07     ` Christian Brauner
2018-05-28 13:49 ` [PATCH 6/8] signal: drop else branch in do_signal_stop() Christian Brauner
2018-05-28 13:49 ` [PATCH 7/8] signal: make do_sigpending() void Christian Brauner
2018-05-28 14:20   ` Al Viro
2018-05-28 13:49 ` [PATCH 8/8] signal: simplify rt_sigaction() Christian Brauner
2018-05-29  6:47   ` Christoph Hellwig
2018-05-29 10:24     ` Christian Brauner

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=20180528140749.GY30522@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=christian@brauner.io \
    --cc=ebiederm@xmission.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=james.morris@microsoft.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=sds@tycho.nsa.gov \
    /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

Powered by JetHome