From: Austin Kim <austindh.kim@gmail.com>
To: Casey Schaufler <casey@schaufler-ca.com>
Cc: James Morris <jmorris@namei.org>,
"Serge E. Hallyn" <serge@hallyn.com>,
linux-security-module <linux-security-module@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
kernel-team@lge.com
Subject: Re: [PATCH] smack: clean up smack_enabled to be more readable
Date: Thu, 4 Nov 2021 07:24:57 +0900 [thread overview]
Message-ID: <CADLLry7i=MB1diZmHXAv3tf8yTMgwceTA4OeuWPVrxt-13wdZQ@mail.gmail.com> (raw)
In-Reply-To: <79835dce-7e15-38e2-5341-2fb246a445e7@schaufler-ca.com>
2021년 11월 4일 (목) 오전 1:01, Casey Schaufler <casey@schaufler-ca.com>님이 작성:
>
> On 11/3/2021 12:31 AM, Austin Kim wrote:
> > 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>
>
> A couple of changes below.
>
> > ---
> > 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)
>
> If you want to use a bool you should use it fully.
> + if (!smack_enabled)
>
> > 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)
>
> Same here.
Thanks for feedback.
Let me resend the patch.
BR,
Austin Kim
>
> > return 0;
> >
> > err = smk_init_sysfs();
prev parent reply other threads:[~2021-11-03 22:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-03 7:31 [PATCH] smack: clean up smack_enabled to be more readable Austin Kim
2021-11-03 16:01 ` Casey Schaufler
2021-11-03 22:24 ` Austin Kim [this message]
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='CADLLry7i=MB1diZmHXAv3tf8yTMgwceTA4OeuWPVrxt-13wdZQ@mail.gmail.com' \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).