public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v3 1/2] capability: add cap_isidentical
@ 2023-02-28 20:04 Alexey Dobriyan
  0 siblings, 0 replies; 13+ messages in thread
From: Alexey Dobriyan @ 2023-02-28 20:04 UTC (permalink / raw)
  To: Mateusz Guzik
  Cc: linux-kernel, Serge Hallyn, paul, linux-fsdevel,
	linux-security-module, viro

> +static inline bool cap_isidentical(const kernel_cap_t a, const kernel_cap_t b)
> +{
> +	unsigned __capi;
> +	CAP_FOR_EACH_U32(__capi) {
> +		if (a.cap[__capi] != b.cap[__capi])
> +			return false;
> +	}
> +	return true;
> +}

capability_eq() maybe? "isidentical" is kind of ugly.

^ permalink raw reply	[flat|nested] 13+ messages in thread
* [PATCH v3 1/2] capability: add cap_isidentical
@ 2023-01-25 15:55 Mateusz Guzik
  2023-02-28  1:14 ` Linus Torvalds
  0 siblings, 1 reply; 13+ messages in thread
From: Mateusz Guzik @ 2023-01-25 15:55 UTC (permalink / raw)
  To: viro
  Cc: serge, torvalds, paul, linux-fsdevel, linux-kernel,
	linux-security-module, Mateusz Guzik

Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
Reviewed-by: Serge Hallyn <serge@hallyn.com>
---
 include/linux/capability.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/linux/capability.h b/include/linux/capability.h
index 65efb74c3585..736a973c677a 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -156,6 +156,16 @@ static inline bool cap_isclear(const kernel_cap_t a)
 	return true;
 }
 
+static inline bool cap_isidentical(const kernel_cap_t a, const kernel_cap_t b)
+{
+	unsigned __capi;
+	CAP_FOR_EACH_U32(__capi) {
+		if (a.cap[__capi] != b.cap[__capi])
+			return false;
+	}
+	return true;
+}
+
 /*
  * Check if "a" is a subset of "set".
  * return true if ALL of the capabilities in "a" are also in "set"
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-03-01 18:14 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-28 20:04 [PATCH v3 1/2] capability: add cap_isidentical Alexey Dobriyan
  -- strict thread matches above, loose matches on Subject: below --
2023-01-25 15:55 Mateusz Guzik
2023-02-28  1:14 ` Linus Torvalds
2023-02-28  2:46   ` Casey Schaufler
2023-02-28 14:47     ` Mateusz Guzik
2023-02-28 19:39       ` Linus Torvalds
2023-02-28 19:51         ` Linus Torvalds
2023-02-28 20:48         ` Linus Torvalds
2023-02-28 21:21           ` Mateusz Guzik
2023-02-28 21:29             ` Linus Torvalds
2023-03-01 18:13               ` Linus Torvalds
2023-02-28 17:32     ` Serge E. Hallyn
2023-02-28 17:52       ` Casey Schaufler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox