From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751666AbcGNQRi (ORCPT ); Thu, 14 Jul 2016 12:17:38 -0400 Received: from nm25-vm1.bullet.mail.bf1.yahoo.com ([98.139.212.155]:42279 "EHLO nm25-vm1.bullet.mail.bf1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751282AbcGNQRd (ORCPT ); Thu, 14 Jul 2016 12:17:33 -0400 X-Yahoo-Newman-Id: 429273.22224.bm@smtp108.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 0s3Lc1MVM1nXwtgvfmKd3UldMdrP6uuHqZFmmRAK3ptBPcb 5xt9Nkb_PSnLyUsrnMsExJZJG0OmiTWMVmH4K9YOOBuLY_8M_UAgqXXjOgT7 0dvWnD6TO4UyOKBwheWYlaennNuX62y8w2xjVOzetjI_w6vZD9bXYWTl_qKq D6s8D1Z4ZCRwS71ms8cJHxF1sQGl9W2Nyh_MGNUUAw5ZaHcqrRKO3VjoGxKr BVUm2UjLUXGYx27TgrAt9B06B2lXCkLHqHrMvlsF_dHAY28m0OxjRoWgZlXu VCGZKt.20wRgbkLzTZJUtSjM37skFGGFLPL3xUfsbvyLVYO_cB1lYsoLZHIG H2QXt2PoYucQeAUiQ.7b1fNzeZGrHMLaybBMpkC.hwbzbvJvSNx63Nc5mWsF .t1.hX.nHc9ctwnqRr6EU6NvDNwMRRaS1svfA1REI3uGyHbbeLIwph0.L0uI 7gxrBRQazs0pWiCZCoOd6rJnPrKMHRw0tNk_ZMEB9W98oVNdkd5ou2ll48rB 3RXLmtG9hNcloXFxeCzzM1FKLkdjMBfgcC_vtiNxw0LYPDwkZfXpAoNx15_Z Y06wTew9eWjN0 X-Yahoo-SMTP: OIJXglSswBDfgLtXluJ6wiAYv6_cnw-- Subject: Re: [PATCH] security: Use IS_ENABLED() instead of checking for built-in or module To: Javier Martinez Canillas , linux-kernel@vger.kernel.org References: <1468512050-26272-1-git-send-email-javier@osg.samsung.com> Cc: "Serge E. Hallyn" , Paul Moore , linux-security-module@vger.kernel.org, Stephen Smalley , Eric Paris , selinux@tycho.nsa.gov, James Morris From: Casey Schaufler Message-ID: Date: Thu, 14 Jul 2016 09:17:27 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1468512050-26272-1-git-send-email-javier@osg.samsung.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/14/2016 9:00 AM, Javier Martinez Canillas wrote: > The IS_ENABLED() macro checks if a Kconfig symbol has been enabled either > built-in or as a module, use that macro instead of open coding the same. Why? > > Signed-off-by: Javier Martinez Canillas > --- > > security/lsm_audit.c | 2 +- > security/selinux/hooks.c | 12 ++++++------ > security/smack/smack_netfilter.c | 4 ++-- > 3 files changed, 9 insertions(+), 9 deletions(-) > > diff --git a/security/lsm_audit.c b/security/lsm_audit.c > index cccbf3068cdc..5369036cf905 100644 > --- a/security/lsm_audit.c > +++ b/security/lsm_audit.c > @@ -99,7 +99,7 @@ int ipv4_skb_to_auditdata(struct sk_buff *skb, > } > return ret; > } > -#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) > +#if IS_ENABLED(CONFIG_IPV6) > /** > * ipv6_skb_to_auditdata : fill auditdata from skb > * @skb : the skb > diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c > index ec30880c4b98..c20ea9fe9274 100644 > --- a/security/selinux/hooks.c > +++ b/security/selinux/hooks.c > @@ -3984,7 +3984,7 @@ out: > return ret; > } > > -#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) > +#if IS_ENABLED(CONFIG_IPV6) > > /* Returns error only if unable to parse addresses */ > static int selinux_parse_skb_ipv6(struct sk_buff *skb, > @@ -4075,7 +4075,7 @@ static int selinux_parse_skb(struct sk_buff *skb, struct common_audit_data *ad, > &ad->u.net->v4info.daddr); > goto okay; > > -#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) > +#if IS_ENABLED(CONFIG_IPV6) > case PF_INET6: > ret = selinux_parse_skb_ipv6(skb, ad, proto); > if (ret) > @@ -5029,7 +5029,7 @@ static unsigned int selinux_ipv4_forward(void *priv, > return selinux_ip_forward(skb, state->in, PF_INET); > } > > -#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) > +#if IS_ENABLED(CONFIG_IPV6) > static unsigned int selinux_ipv6_forward(void *priv, > struct sk_buff *skb, > const struct nf_hook_state *state) > @@ -5087,7 +5087,7 @@ static unsigned int selinux_ipv4_output(void *priv, > return selinux_ip_output(skb, PF_INET); > } > > -#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) > +#if IS_ENABLED(CONFIG_IPV6) > static unsigned int selinux_ipv6_output(void *priv, > struct sk_buff *skb, > const struct nf_hook_state *state) > @@ -5273,7 +5273,7 @@ static unsigned int selinux_ipv4_postroute(void *priv, > return selinux_ip_postroute(skb, state->out, PF_INET); > } > > -#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) > +#if IS_ENABLED(CONFIG_IPV6) > static unsigned int selinux_ipv6_postroute(void *priv, > struct sk_buff *skb, > const struct nf_hook_state *state) > @@ -6317,7 +6317,7 @@ static struct nf_hook_ops selinux_nf_ops[] = { > .hooknum = NF_INET_LOCAL_OUT, > .priority = NF_IP_PRI_SELINUX_FIRST, > }, > -#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) > +#if IS_ENABLED(CONFIG_IPV6) > { > .hook = selinux_ipv6_postroute, > .pf = NFPROTO_IPV6, > diff --git a/security/smack/smack_netfilter.c b/security/smack/smack_netfilter.c > index aa6bf1b22ec5..205b785fb400 100644 > --- a/security/smack/smack_netfilter.c > +++ b/security/smack/smack_netfilter.c > @@ -20,7 +20,7 @@ > #include > #include "smack.h" > > -#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) > +#if IS_ENABLED(CONFIG_IPV6) > > static unsigned int smack_ipv6_output(void *priv, > struct sk_buff *skb, > @@ -64,7 +64,7 @@ static struct nf_hook_ops smack_nf_ops[] = { > .hooknum = NF_INET_LOCAL_OUT, > .priority = NF_IP_PRI_SELINUX_FIRST, > }, > -#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) > +#if IS_ENABLED(CONFIG_IPV6) > { > .hook = smack_ipv6_output, > .pf = NFPROTO_IPV6,