From patchwork Thu Jul 14 16:00:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 9230121 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 47C46607D0 for ; Thu, 14 Jul 2016 16:22:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3889E27F96 for ; Thu, 14 Jul 2016 16:22:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D07628285; Thu, 14 Jul 2016 16:22:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=unavailable version=3.3.1 Received: from emsm-gh1-uea11.nsa.gov (emsm-gh1-uea11.nsa.gov [8.44.101.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5798727F96 for ; Thu, 14 Jul 2016 16:22:25 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.28,363,1464652800"; d="scan'208";a="17650982" IronPort-PHdr: =?us-ascii?q?9a23=3AznfkHxUm0y6tulbW0RcV/N8scf/V8LGtZVwlr6E/?= =?us-ascii?q?grcLSJyIuqrYYBaCt8tkgFKBZ4jH8fUM07OQ6PG4HzBaqsfR+Fk5M7V0Hycfjs?= =?us-ascii?q?sXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aJBzzOEJP?= =?us-ascii?q?K/jvHcaK1oLshrj0p8eYMlUArQH+SIs6FA+xowTVu5teqqpZAYF19CH0pGBVcf?= =?us-ascii?q?9d32JiKAHbtR/94sCt4MwrqHwI6LoJvvRNWqTifqk+UacQTHF/azh0t/DxsVH/?= =?us-ascii?q?aSfHpj5FCiRF2idOGBXPuRHmQo+j9WzirO141TWaMNDtC7EyVzO54qwtVA7jiC?= =?us-ascii?q?BBMTUi+yfSi8g3iatapBeooVt425LVZ4eOc+FzeqLbYMNJeGxaQ8wEUiVABp+7?= =?us-ascii?q?PZACC+sHIPYdtYTkulYVsTOiFAKsA6Xp0TYOiXjoirYn2eYsGh2TwQo7AtgVu2?= =?us-ascii?q?7VptimCKBHVeGz0bmNzjjZaf5S8Sny5ZKOcR07p/yIG7Vqfpn/004qQiHMkFSd?= =?us-ascii?q?s8TANimJ1+IAoSCw5uxhUeamkCZzqQhvozW17sA3hc/Sj4cO11bLsy5+xdBmdp?= =?us-ascii?q?WDVEdnbIv8Q9NrvCaAOt4zG5p6Tg=3D=3D?= X-IPAS-Result: =?us-ascii?q?A2E4BwAHu4dX/wHyM5BcHQGED2O6Xh+HN0wBAQEBAQECAmI?= =?us-ascii?q?ngjIEARIBghoCDAEXEwwIAh4LAwMBAgYCFycCCAgDAS0VHwsFGASIDwIBsWEBA?= =?us-ascii?q?Y8SAQEIJ48JEQGFdwWGVAmSQo5biWSFSQJIkCWCCRyBaFKGOYE1AQEB?= Received: from unknown (HELO tarius.tycho.ncsc.mil) ([144.51.242.1]) by emsm-gh1-uea11.nsa.gov with ESMTP; 14 Jul 2016 16:22:12 +0000 Received: from prometheus.infosec.tycho.ncsc.mil (prometheus [192.168.25.40]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id u6EGM5hk013606; Thu, 14 Jul 2016 12:22:09 -0400 Received: from tarius.tycho.ncsc.mil (tarius.infosec.tycho.ncsc.mil [144.51.242.1]) by prometheus.infosec.tycho.ncsc.mil (8.15.2/8.15.2) with ESMTP id u6EG1KoG070619 for ; Thu, 14 Jul 2016 12:01:20 -0400 Received: from goalie.tycho.ncsc.mil (goalie [144.51.242.250]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id u6EG1HTg010503; Thu, 14 Jul 2016 12:01:18 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1CFAQDxtYdXfTFzGzRcHoRytlyECoYZgTNNAQEBAQEBEwEBFjOFIQEXLyNPSzeIMgGxbAEBjxQxlRIFhlQJkkKOW48tAkiPUYIMAVAcgWhSh24BAQE X-IPAS-Result: A1CFAQDxtYdXfTFzGzRcHoRytlyECoYZgTNNAQEBAQEBEwEBFjOFIQEXLyNPSzeIMgGxbAEBjxQxlRIFhlQJkkKOW48tAkiPUYIMAVAcgWhSh24BAQE X-IronPort-AV: E=Sophos;i="5.28,363,1464667200"; d="scan'208";a="5581074" Received: from emsm-gh1-uea10.corp.nsa.gov (HELO emsm-gh1-uea10.nsa.gov) ([10.208.41.36]) by goalie.tycho.ncsc.mil with ESMTP; 14 Jul 2016 12:01:16 -0400 IronPort-PHdr: =?us-ascii?q?9a23=3Axjsn/xZvhcI02n9WpcFeBPn/LSx+4OfEezUN459i?= =?us-ascii?q?sYplN5qZpcu9bnLW6fgltlLVR4KTs6sC0LuO9fy6Ej1dqb+681k6OKRWUBEEjc?= =?us-ascii?q?hE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i760zceF13FOBZv?= =?us-ascii?q?IaytQ8iJ3pzxi7r5qsCbSj4LrQL1Wal1IhSyoFeZnegtqqwmFJwMzADUqGBDYe?= =?us-ascii?q?VcyDAgD1uSmxHh+pX4p8Y7oGx48sgs/M9YUKj8Y79wDfkBVGxnYCgJ45jvtB/e?= =?us-ascii?q?XU6M62EaX2E+jBVFGU7G4Qv8U5O3tTH15cRn3yzPH8ToTL0uERGr9btqThL6wA?= =?us-ascii?q?wOMT899GjMwphyhbxarQiJoAdwhZXdZZqIMvU4daTYK4BJDVFdV9pcAnQSSri3?= =?us-ascii?q?aJECWq9YZb5V?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0HJAgCUtodXfTFzGzRchRC2XIQKhhmBN?= =?us-ascii?q?E0BAQEBAQECAg8BARYzL4IyBAESAYIoARcvI09LN4gyAbFtAQGPFDGVEgWGVAm?= =?us-ascii?q?SQo5bjy0CSI9RggwBUByBaFKHbgEBAQ?= X-IPAS-Result: =?us-ascii?q?A0HJAgCUtodXfTFzGzRchRC2XIQKhhmBNE0BAQEBAQECAg8?= =?us-ascii?q?BARYzL4IyBAESAYIoARcvI09LN4gyAbFtAQGPFDGVEgWGVAmSQo5bjy0CSI9Rg?= =?us-ascii?q?gwBUByBaFKHbgEBAQ?= X-IronPort-AV: E=Sophos;i="5.28,363,1464652800"; d="scan'208";a="15580393" Received: from ec2-52-27-115-49.us-west-2.compute.amazonaws.com (HELO s-opensource.com) ([52.27.115.49]) by emsm-gh1-uea10.nsa.gov with ESMTP; 14 Jul 2016 16:01:14 +0000 Received: from minerva.sisa.samsung.com (host-111.58.217.201.copaco.com.py [201.217.58.111]) by s-opensource.com (Postfix) with ESMTPSA id 7E845A0DE1; Thu, 14 Jul 2016 16:01:05 +0000 (UTC) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Subject: [PATCH] security: Use IS_ENABLED() instead of checking for built-in or module Date: Thu, 14 Jul 2016 12:00:50 -0400 Message-Id: <1468512050-26272-1-git-send-email-javier@osg.samsung.com> X-Mailer: git-send-email 2.5.5 X-Mailman-Approved-At: Thu, 14 Jul 2016 12:22:04 -0400 X-BeenThere: selinux@tycho.nsa.gov X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Security-Enhanced Linux \(SELinux\) mailing list" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: James Morris , Javier Martinez Canillas , linux-security-module@vger.kernel.org, selinux@tycho.nsa.gov, Stephen Smalley MIME-Version: 1.0 Errors-To: selinux-bounces@tycho.nsa.gov Sender: "Selinux" X-Virus-Scanned: ClamAV using ClamSMTP 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. 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,