Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1270928 > unrolled thread

[PATCH 1/2] security: remove unused cap_is_fs_cap function

Started byYaowei Bai <baiyaowei@cmss.chinamobile.com>
First post2015-11-17 08:30 +0100
Last post2015-11-18 01:00 +0100
Articles 6 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/2] security: remove unused cap_is_fs_cap function Yaowei Bai <baiyaowei@cmss.chinamobile.com> - 2015-11-17 08:30 +0100
    [PATCH 2/2] security/capability.h: cap_issubset/isclear can be boolean Yaowei Bai <baiyaowei@cmss.chinamobile.com> - 2015-11-17 08:30 +0100
      Re: [PATCH 2/2] security/capability.h: cap_issubset/isclear can be  boolean "Serge E. Hallyn" <serge@hallyn.com> - 2015-11-17 18:40 +0100
      Re: [PATCH 2/2] security/capability.h: cap_issubset/isclear can be  boolean James Morris <jmorris@namei.org> - 2015-11-18 01:00 +0100
    Re: [PATCH 1/2] security: remove unused cap_is_fs_cap function "Serge E. Hallyn" <serge@hallyn.com> - 2015-11-17 18:30 +0100
    Re: [PATCH 1/2] security: remove unused cap_is_fs_cap function James Morris <jmorris@namei.org> - 2015-11-18 01:00 +0100

#1270928 — [PATCH 1/2] security: remove unused cap_is_fs_cap function

FromYaowei Bai <baiyaowei@cmss.chinamobile.com>
Date2015-11-17 08:30 +0100
Subject[PATCH 1/2] security: remove unused cap_is_fs_cap function
Message-ID<qvISd-1Vh-5@gated-at.bofh.it>
Since commit 3bc1fa8a ("LSM: remove BSD secure level security module")
there is no user of cap_is_fs_cap any more, so remove it.

Signed-off-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
---
 include/linux/capability.h | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/include/linux/capability.h b/include/linux/capability.h
index af9f0b9..b032003 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -171,12 +171,6 @@ static inline int cap_issubset(const kernel_cap_t a, const kernel_cap_t set)
 
 /* Used to decide between falling back on the old suser() or fsuser(). */
 
-static inline int cap_is_fs_cap(int cap)
-{
-	const kernel_cap_t __cap_fs_set = CAP_FS_SET;
-	return !!(CAP_TO_MASK(cap) & __cap_fs_set.cap[CAP_TO_INDEX(cap)]);
-}
-
 static inline kernel_cap_t cap_drop_fs_set(const kernel_cap_t a)
 {
 	const kernel_cap_t __cap_fs_set = CAP_FS_SET;
-- 
1.9.1



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1270929 — [PATCH 2/2] security/capability.h: cap_issubset/isclear can be boolean

FromYaowei Bai <baiyaowei@cmss.chinamobile.com>
Date2015-11-17 08:30 +0100
Subject[PATCH 2/2] security/capability.h: cap_issubset/isclear can be boolean
Message-ID<qvISd-1Vh-11@gated-at.bofh.it>
In reply to#1270928
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



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1271485 — Re: [PATCH 2/2] security/capability.h: cap_issubset/isclear can be boolean

From"Serge E. Hallyn" <serge@hallyn.com>
Date2015-11-17 18:40 +0100
SubjectRe: [PATCH 2/2] security/capability.h: cap_issubset/isclear can be boolean
Message-ID<qvSoz-85I-27@gated-at.bofh.it>
In reply to#1270929
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@cmss.chinamobile.com>

Acked-by: Serge Hallyn <serge.hallyn@canonical.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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1271745 — Re: [PATCH 2/2] security/capability.h: cap_issubset/isclear can be boolean

FromJames Morris <jmorris@namei.org>
Date2015-11-18 01:00 +0100
SubjectRe: [PATCH 2/2] security/capability.h: cap_issubset/isclear can be boolean
Message-ID<qvYkh-3nX-1@gated-at.bofh.it>
In reply to#1270929
On Tue, 17 Nov 2015, 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@cmss.chinamobile.com>

Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git next


-- 
James Morris
<jmorris@namei.org>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1271470

From"Serge E. Hallyn" <serge@hallyn.com>
Date2015-11-17 18:30 +0100
Message-ID<qvSeR-81H-3@gated-at.bofh.it>
In reply to#1270928
On Tue, Nov 17, 2015 at 03:25:23PM +0800, Yaowei Bai wrote:
> Since commit 3bc1fa8a ("LSM: remove BSD secure level security module")
> there is no user of cap_is_fs_cap any more, so remove it.
> 
> Signed-off-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com>

Acked-by: Serge Hallyn <serge.hallyn@canonical.com>

> ---
>  include/linux/capability.h | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/include/linux/capability.h b/include/linux/capability.h
> index af9f0b9..b032003 100644
> --- a/include/linux/capability.h
> +++ b/include/linux/capability.h
> @@ -171,12 +171,6 @@ static inline int cap_issubset(const kernel_cap_t a, const kernel_cap_t set)
>  
>  /* Used to decide between falling back on the old suser() or fsuser(). */
>  
> -static inline int cap_is_fs_cap(int cap)
> -{
> -	const kernel_cap_t __cap_fs_set = CAP_FS_SET;
> -	return !!(CAP_TO_MASK(cap) & __cap_fs_set.cap[CAP_TO_INDEX(cap)]);
> -}
> -
>  static inline kernel_cap_t cap_drop_fs_set(const kernel_cap_t a)
>  {
>  	const kernel_cap_t __cap_fs_set = CAP_FS_SET;
> -- 
> 1.9.1
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1271749

FromJames Morris <jmorris@namei.org>
Date2015-11-18 01:00 +0100
Message-ID<qvYki-3nX-11@gated-at.bofh.it>
In reply to#1270928
On Tue, 17 Nov 2015, Yaowei Bai wrote:

> Since commit 3bc1fa8a ("LSM: remove BSD secure level security module")
> there is no user of cap_is_fs_cap any more, so remove it.
> 
> Signed-off-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com>

Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git next

-- 
James Morris
<jmorris@namei.org>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web