All of lore.kernel.org
 help / color / mirror / Atom feed
From: Austin Kim <austindh.kim@gmail.com>
To: casey@schaufler-ca.com, jmorris@namei.org, serge@hallyn.com
Cc: linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel-team@lge.com
Subject: [PATCH] smack: clean up smack_enabled to be more readable
Date: Wed, 3 Nov 2021 07:31:31 +0000	[thread overview]
Message-ID: <20211103073131.GA15173@raspberrypi> (raw)

The smack_enabled is only set to 0, 1. So changing type of smack_enabled 
as bool may make relevant routine be more readable.

Signed-off-by: Austin Kim <austindh.kim@gmail.com>
---
 security/smack/smack.h           | 2 +-
 security/smack/smack_lsm.c       | 4 ++--
 security/smack/smack_netfilter.c | 2 +-
 security/smack/smackfs.c         | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/security/smack/smack.h b/security/smack/smack.h
index 99c3422596ab..dc1726f5953f 100644
--- a/security/smack/smack.h
+++ b/security/smack/smack.h
@@ -302,7 +302,7 @@ int smack_populate_secattr(struct smack_known *skp);
 /*
  * Shared data.
  */
-extern int smack_enabled __initdata;
+extern bool smack_enabled __initdata;
 extern int smack_cipso_direct;
 extern int smack_cipso_mapped;
 extern struct smack_known *smack_net_ambient;
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index efd35b07c7f8..ba3b46bd2ceb 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -56,7 +56,7 @@ static DEFINE_MUTEX(smack_ipv6_lock);
 static LIST_HEAD(smk_ipv6_port_list);
 #endif
 struct kmem_cache *smack_rule_cache;
-int smack_enabled __initdata;
+bool smack_enabled __initdata;
 
 #define A(s) {"smack"#s, sizeof("smack"#s) - 1, Opt_##s}
 static struct {
@@ -4953,7 +4953,7 @@ static __init int smack_init(void)
 	 * Register with LSM
 	 */
 	security_add_hooks(smack_hooks, ARRAY_SIZE(smack_hooks), "smack");
-	smack_enabled = 1;
+	smack_enabled = true;
 
 	pr_info("Smack:  Initializing.\n");
 #ifdef CONFIG_SECURITY_SMACK_NETFILTER
diff --git a/security/smack/smack_netfilter.c b/security/smack/smack_netfilter.c
index b945c1d3a743..82092d9387a3 100644
--- a/security/smack/smack_netfilter.c
+++ b/security/smack/smack_netfilter.c
@@ -70,7 +70,7 @@ static struct pernet_operations smack_net_ops = {
 
 static int __init smack_nf_ip_init(void)
 {
-	if (smack_enabled == 0)
+	if (smack_enabled == false)
 		return 0;
 
 	printk(KERN_DEBUG "Smack: Registering netfilter hooks\n");
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
index 658eab05599e..7649ad8cc335 100644
--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -2993,7 +2993,7 @@ static int __init init_smk_fs(void)
 	int err;
 	int rc;
 
-	if (smack_enabled == 0)
+	if (smack_enabled == false)
 		return 0;
 
 	err = smk_init_sysfs();
-- 
2.20.1


             reply	other threads:[~2021-11-03  7:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-03  7:31 Austin Kim [this message]
2021-11-03 16:01 ` [PATCH] smack: clean up smack_enabled to be more readable Casey Schaufler
2021-11-03 22:24   ` Austin Kim

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=20211103073131.GA15173@raspberrypi \
    --to=austindh.kim@gmail.com \
    --cc=casey@schaufler-ca.com \
    --cc=jmorris@namei.org \
    --cc=kernel-team@lge.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 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.