[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180602103653.18181-3-christian@brauner.io>
Date: Sat, 2 Jun 2018 12:36:38 +0200
From: Christian Brauner <christian@...uner.io>
To: linux-kernel@...r.kernel.org
Cc: ebiederm@...ssion.com, gregkh@...uxfoundation.org,
mingo@...nel.org, james.morris@...rosoft.com,
keescook@...omium.org, peterz@...radead.org, sds@...ho.nsa.gov,
viro@...iv.linux.org.uk, akpm@...ux-foundation.org,
oleg@...hat.com, Christian Brauner <christian@...uner.io>
Subject: [PATCH v3 02/17] signal: make kill_as_cred_perm() return bool
kill_as_cred_perm() already behaves like a boolean function. Let's actually
declare it as such too.
Signed-off-by: Christian Brauner <christian@...uner.io>
---
v2->v3:
* unchanged
v1->v2:
* unchanged
v0->v1:
* simplify to use a single return
---
kernel/signal.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/kernel/signal.c b/kernel/signal.c
index c756008d589e..6c71d6b8d2b8 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,
- struct task_struct *target)
+static inline 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 uid_eq(cred->euid, pcred->suid) ||
+ uid_eq(cred->euid, pcred->uid) ||
+ uid_eq(cred->uid, pcred->suid) ||
+ uid_eq(cred->uid, pcred->uid);
}
/* like kill_pid_info(), but doesn't use uid/euid of "current" */
--
2.17.0
Powered by blists - more mailing lists