[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151117173507.GB11708@mail.hallyn.com>
Date: Tue, 17 Nov 2015 11:35:07 -0600
From: "Serge E. Hallyn" <serge@...lyn.com>
To: Yaowei Bai <baiyaowei@...s.chinamobile.com>
Cc: james.l.morris@...cle.com, serge@...lyn.com,
linux-security-module@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] security/capability.h: cap_issubset/isclear can be
boolean
On Tue, Nov 17, 2015 at 03:25:24PM +0800, Yaowei Bai wrote:
> 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@...s.chinamobile.com>
Acked-by: Serge Hallyn <serge.hallyn@...onical.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
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists