All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Moore <paul@paul-moore.com>
To: selinux@vger.kernel.org
Subject: [PATCH 06/21] selinux: fix style issues in security/selinux/ss/context.h
Date: Thu, 22 Feb 2024 18:52:24 -0500	[thread overview]
Message-ID: <20240222235708.386652-29-paul@paul-moore.com> (raw)
In-Reply-To: <20240222235708.386652-23-paul@paul-moore.com>

As part of on ongoing effort to perform more automated testing and
provide more tools for individual developers to validate their
patches before submitting, we are trying to make our code
"clang-format clean".  My hope is that once we have fixed all of our
style "quirks", developers will be able to run clang-format on their
patches to help avoid silly formatting problems and ensure their
changes fit in well with the rest of the SELinux kernel code.

Signed-off-by: Paul Moore <paul@paul-moore.com>
---
 security/selinux/ss/context.h | 41 +++++++++++++++++++----------------
 1 file changed, 22 insertions(+), 19 deletions(-)

diff --git a/security/selinux/ss/context.h b/security/selinux/ss/context.h
index 1f59468c0759..7ccab2e6965f 100644
--- a/security/selinux/ss/context.h
+++ b/security/selinux/ss/context.h
@@ -13,6 +13,7 @@
  *
  * Author : Stephen Smalley, <stephen.smalley.work@gmail.com>
  */
+
 #ifndef _SS_CONTEXT_H_
 #define _SS_CONTEXT_H_
 
@@ -28,9 +29,9 @@ struct context {
 	u32 user;
 	u32 role;
 	u32 type;
-	u32 len;        /* length of string in bytes */
+	u32 len; /* length of string in bytes */
 	struct mls_range range;
-	char *str;	/* string representation if context cannot be mapped. */
+	char *str; /* string representation if context cannot be mapped. */
 };
 
 static inline void mls_context_init(struct context *c)
@@ -38,7 +39,8 @@ static inline void mls_context_init(struct context *c)
 	memset(&c->range, 0, sizeof(c->range));
 }
 
-static inline int mls_context_cpy(struct context *dst, const struct context *src)
+static inline int mls_context_cpy(struct context *dst,
+				  const struct context *src)
 {
 	int rc;
 
@@ -58,7 +60,8 @@ static inline int mls_context_cpy(struct context *dst, const struct context *src
 /*
  * Sets both levels in the MLS range of 'dst' to the low level of 'src'.
  */
-static inline int mls_context_cpy_low(struct context *dst, const struct context *src)
+static inline int mls_context_cpy_low(struct context *dst,
+				      const struct context *src)
 {
 	int rc;
 
@@ -78,7 +81,8 @@ static inline int mls_context_cpy_low(struct context *dst, const struct context
 /*
  * Sets both levels in the MLS range of 'dst' to the high level of 'src'.
  */
-static inline int mls_context_cpy_high(struct context *dst, const struct context *src)
+static inline int mls_context_cpy_high(struct context *dst,
+				       const struct context *src)
 {
 	int rc;
 
@@ -95,9 +99,9 @@ static inline int mls_context_cpy_high(struct context *dst, const struct context
 	return rc;
 }
 
-
 static inline int mls_context_glblub(struct context *dst,
-				     const struct context *c1, const struct context *c2)
+				     const struct context *c1,
+				     const struct context *c2)
 {
 	struct mls_range *dr = &dst->range;
 	const struct mls_range *r1 = &c1->range, *r2 = &c2->range;
@@ -114,13 +118,13 @@ static inline int mls_context_glblub(struct context *dst,
 	/* Take the least of the high */
 	dr->level[1].sens = min(r1->level[1].sens, r2->level[1].sens);
 
-	rc = ebitmap_and(&dr->level[0].cat,
-			 &r1->level[0].cat, &r2->level[0].cat);
+	rc = ebitmap_and(&dr->level[0].cat, &r1->level[0].cat,
+			 &r2->level[0].cat);
 	if (rc)
 		goto out;
 
-	rc = ebitmap_and(&dr->level[1].cat,
-			 &r1->level[1].cat, &r2->level[1].cat);
+	rc = ebitmap_and(&dr->level[1].cat, &r1->level[1].cat,
+			 &r2->level[1].cat);
 	if (rc)
 		goto out;
 
@@ -128,7 +132,8 @@ static inline int mls_context_glblub(struct context *dst,
 	return rc;
 }
 
-static inline int mls_context_cmp(const struct context *c1, const struct context *c2)
+static inline int mls_context_cmp(const struct context *c1,
+				  const struct context *c2)
 {
 	return ((c1->range.level[0].sens == c2->range.level[0].sens) &&
 		ebitmap_cmp(&c1->range.level[0].cat, &c2->range.level[0].cat) &&
@@ -183,19 +188,17 @@ static inline void context_destroy(struct context *c)
 	mls_context_destroy(c);
 }
 
-static inline int context_cmp(const struct context *c1, const struct context *c2)
+static inline int context_cmp(const struct context *c1,
+			      const struct context *c2)
 {
 	if (c1->len && c2->len)
 		return (c1->len == c2->len && !strcmp(c1->str, c2->str));
 	if (c1->len || c2->len)
 		return 0;
-	return ((c1->user == c2->user) &&
-		(c1->role == c2->role) &&
-		(c1->type == c2->type) &&
-		mls_context_cmp(c1, c2));
+	return ((c1->user == c2->user) && (c1->role == c2->role) &&
+		(c1->type == c2->type) && mls_context_cmp(c1, c2));
 }
 
 u32 context_compute_hash(const struct context *c);
 
-#endif	/* _SS_CONTEXT_H_ */
-
+#endif /* _SS_CONTEXT_H_ */
-- 
2.43.2


  parent reply	other threads:[~2024-02-22 23:59 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-22 23:52 [PATCH 00/21] selinux: fix style issues in security/selinux/ss Paul Moore
2024-02-22 23:52 ` [PATCH 01/21] selinux: fix style issues in security/selinux/ss/avtab.h Paul Moore
2024-02-22 23:52 ` [PATCH 02/21] selinux: fix style issues in security/selinux/ss/avtab.c Paul Moore
2024-02-22 23:52 ` [PATCH 03/21] selinux: fix style issues in security/selinux/ss/conditional.h Paul Moore
2024-02-22 23:52 ` [PATCH 04/21] selinux: fix style issues in security/selinux/ss/conditional.c Paul Moore
2024-02-22 23:52 ` [PATCH 05/21] selinux: fix style issues in security/selinux/ss/constraint.h Paul Moore
2024-02-22 23:52 ` Paul Moore [this message]
2024-02-22 23:52 ` [PATCH 07/21] selinux: fix style issues in security/selinux/ss/context.h Paul Moore
2024-02-22 23:52 ` [PATCH 08/21] selinux: fix style issues in security/selinux/ss/ebitmap.h Paul Moore
2024-02-22 23:52 ` [PATCH 09/21] selinux: fix style issues in security/selinux/ss/ebitmap.c Paul Moore
2024-02-22 23:52 ` [PATCH 10/21] selinux: fix style issues in security/selinux/ss/hashtab.h Paul Moore
2024-02-22 23:52 ` [PATCH 11/21] selinux: fix style issues in security/selinux/ss/hashtab.c Paul Moore
2024-02-22 23:52 ` [PATCH 12/21] selinux: fix style issues in security/selinux/ss/mls.h Paul Moore
2024-02-22 23:52 ` [PATCH 13/21] selinux: fix style issues in security/selinux/ss/mls.c Paul Moore
2024-02-22 23:52 ` [PATCH 14/21] selinux: fix style issues in security/selinux/ss/mls_types.h Paul Moore
2024-02-22 23:52 ` [PATCH 15/21] selinux: fix style issues in security/selinux/ss/policydb.h Paul Moore
2024-02-22 23:52 ` [PATCH 16/21] selinux: fix style issues in security/selinux/ss/policydb.c Paul Moore
2024-02-22 23:52 ` [PATCH 17/21] selinux: fix style issues in security/selinux/ss/services.h Paul Moore
2024-02-22 23:52 ` [PATCH 18/21] selinux: fix style issues in security/selinux/ss/sidtab.h Paul Moore
2024-02-22 23:52 ` [PATCH 19/21] selinux: fix style issues in security/selinux/ss/sidtab.c Paul Moore
2024-02-22 23:52 ` [PATCH 20/21] selinux: fix style issues in security/selinux/ss/symtab.h Paul Moore
2024-02-22 23:52 ` [PATCH 21/21] selinux: fix style issues in security/selinux/ss/symtab.c Paul Moore
2024-02-23 22:25 ` [PATCH 0/21] selinux: fix style issues in security/selinux/ss Paul Moore

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=20240222235708.386652-29-paul@paul-moore.com \
    --to=paul@paul-moore.com \
    --cc=selinux@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.