From: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
To: james.l.morris@oracle.com, serge@hallyn.com
Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] security/capability.h: cap_issubset/isclear can be boolean
Date: Tue, 17 Nov 2015 15:25:24 +0800 [thread overview]
Message-ID: <1447745124-8580-2-git-send-email-baiyaowei@cmss.chinamobile.com> (raw)
In-Reply-To: <1447745124-8580-1-git-send-email-baiyaowei@cmss.chinamobile.com>
This patch makes cap_issubset/isclear return bool due to these
functions only using either one or zero as their return
value.
No functional change.
Signed-off-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
---
include/linux/capability.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/linux/capability.h b/include/linux/capability.h
index b032003..f314275 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -145,24 +145,24 @@ static inline kernel_cap_t cap_invert(const kernel_cap_t c)
return dest;
}
-static inline int cap_isclear(const kernel_cap_t a)
+static inline bool cap_isclear(const kernel_cap_t a)
{
unsigned __capi;
CAP_FOR_EACH_U32(__capi) {
if (a.cap[__capi] != 0)
- return 0;
+ return false;
}
- return 1;
+ return true;
}
/*
* Check if "a" is a subset of "set".
- * return 1 if ALL of the capabilities in "a" are also in "set"
- * cap_issubset(0101, 1111) will return 1
- * return 0 if ANY of the capabilities in "a" are not in "set"
- * cap_issubset(1111, 0101) will return 0
+ * return true if ALL of the capabilities in "a" are also in "set"
+ * cap_issubset(0101, 1111) will return true
+ * return false if ANY of the capabilities in "a" are not in "set"
+ * cap_issubset(1111, 0101) will return false
*/
-static inline int cap_issubset(const kernel_cap_t a, const kernel_cap_t set)
+static inline bool cap_issubset(const kernel_cap_t a, const kernel_cap_t set)
{
kernel_cap_t dest;
dest = cap_drop(a, set);
--
1.9.1
next prev parent reply other threads:[~2015-11-17 7:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-17 7:25 [PATCH 1/2] security: remove unused cap_is_fs_cap function Yaowei Bai
2015-11-17 7:25 ` Yaowei Bai [this message]
2015-11-17 17:35 ` [PATCH 2/2] security/capability.h: cap_issubset/isclear can be boolean Serge E. Hallyn
2015-11-17 23:57 ` James Morris
2015-11-17 17:27 ` [PATCH 1/2] security: remove unused cap_is_fs_cap function Serge E. Hallyn
2015-11-17 23:57 ` James Morris
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=1447745124-8580-2-git-send-email-baiyaowei@cmss.chinamobile.com \
--to=baiyaowei@cmss.chinamobile.com \
--cc=james.l.morris@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=serge@hallyn.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
all inboxes | Powered by JetHome®