[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1464760982-3721-1-git-send-email-rui.teng@linux.vnet.ibm.com>
Date: Wed, 1 Jun 2016 14:03:02 +0800
From: Rui Teng <rui.teng@...ux.vnet.ibm.com>
To: serge.hallyn@...onical.com, james.l.morris@...cle.com,
serge@...lyn.com
Cc: linux-security-module@...r.kernel.org,
linux-kernel@...r.kernel.org,
Rui Teng <rui.teng@...ux.vnet.ibm.com>
Subject: [PATCH] security: Use || instead of | for boolean expressions
Sparse spits out the following warning:
security/commoncap.c:989:41: warning: dubious: !x | y
Bitwise and logical are equivalent here, but logical was intended.
Replacing the bit-wise '|' with the boolean '||' silences the sparse warning.
The generated code for both cases is the same.
Signed-off-by: Rui Teng <rui.teng@...ux.vnet.ibm.com>
---
security/commoncap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/security/commoncap.c b/security/commoncap.c
index e7fadde..8f6fb24 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -976,7 +976,7 @@ int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3,
case PR_CAP_AMBIENT:
if (arg2 == PR_CAP_AMBIENT_CLEAR_ALL) {
- if (arg3 | arg4 | arg5)
+ if (arg3 || arg4 || arg5)
return -EINVAL;
new = prepare_creds();
@@ -986,7 +986,7 @@ int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3,
return commit_creds(new);
}
- if (((!cap_valid(arg3)) | arg4 | arg5))
+ if (((!cap_valid(arg3)) || arg4 || arg5))
return -EINVAL;
if (arg2 == PR_CAP_AMBIENT_IS_SET) {
--
2.7.4
Powered by blists - more mailing lists