From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Xiu Jianfeng <xiujianfeng@huawei.com>,
zohar@linux.ibm.com, dmitry.kasatkin@gmail.com,
jmorris@namei.org, serge@hallyn.com
Cc: linux-integrity@vger.kernel.org,
linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next] evm: Use IS_ENABLED to initialize .enabled
Date: Tue, 7 Jun 2022 08:06:37 +0200 [thread overview]
Message-ID: <64511312-df94-c40b-689c-5fc3823e91f5@pengutronix.de> (raw)
In-Reply-To: <20220606101042.89638-1-xiujianfeng@huawei.com>
On 06.06.22 12:10, Xiu Jianfeng wrote:
> Use IS_ENABLED(CONFIG_XXX) instead of #ifdef/#endif statements to
> initialize .enabled, minor simplicity improvement.
>
> Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> security/integrity/evm/evm_main.c | 52 ++++++++++++++-----------------
> 1 file changed, 23 insertions(+), 29 deletions(-)
>
> diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c
> index cc88f02c7562..397fea5b3fa6 100644
> --- a/security/integrity/evm/evm_main.c
> +++ b/security/integrity/evm/evm_main.c
> @@ -36,42 +36,36 @@ static const char * const integrity_status_msg[] = {
> int evm_hmac_attrs;
>
> static struct xattr_list evm_config_default_xattrnames[] = {
> - {.name = XATTR_NAME_SELINUX,
> -#ifdef CONFIG_SECURITY_SELINUX
> - .enabled = true
> -#endif
> + {
> + .name = XATTR_NAME_SELINUX,
> + .enabled = IS_ENABLED(CONFIG_SECURITY_SELINUX)
> },
> - {.name = XATTR_NAME_SMACK,
> -#ifdef CONFIG_SECURITY_SMACK
> - .enabled = true
> -#endif
> + {
> + .name = XATTR_NAME_SMACK,
> + .enabled = IS_ENABLED(CONFIG_SECURITY_SMACK)
> },
> - {.name = XATTR_NAME_SMACKEXEC,
> -#ifdef CONFIG_EVM_EXTRA_SMACK_XATTRS
> - .enabled = true
> -#endif
> + {
> + .name = XATTR_NAME_SMACKEXEC,
> + .enabled = IS_ENABLED(CONFIG_EVM_EXTRA_SMACK_XATTRS)
> },
> - {.name = XATTR_NAME_SMACKTRANSMUTE,
> -#ifdef CONFIG_EVM_EXTRA_SMACK_XATTRS
> - .enabled = true
> -#endif
> + {
> + .name = XATTR_NAME_SMACKTRANSMUTE,
> + .enabled = IS_ENABLED(CONFIG_EVM_EXTRA_SMACK_XATTRS)
> },
> - {.name = XATTR_NAME_SMACKMMAP,
> -#ifdef CONFIG_EVM_EXTRA_SMACK_XATTRS
> - .enabled = true
> -#endif
> + {
> + .name = XATTR_NAME_SMACKMMAP,
> + .enabled = IS_ENABLED(CONFIG_EVM_EXTRA_SMACK_XATTRS)
> },
> - {.name = XATTR_NAME_APPARMOR,
> -#ifdef CONFIG_SECURITY_APPARMOR
> - .enabled = true
> -#endif
> + {
> + .name = XATTR_NAME_APPARMOR,
> + .enabled = IS_ENABLED(CONFIG_SECURITY_APPARMOR)
> },
> - {.name = XATTR_NAME_IMA,
> -#ifdef CONFIG_IMA_APPRAISE
> - .enabled = true
> -#endif
> + {
> + .name = XATTR_NAME_IMA,
> + .enabled = IS_ENABLED(CONFIG_IMA_APPRAISE)
> },
> - {.name = XATTR_NAME_CAPS,
> + {
> + .name = XATTR_NAME_CAPS,
> .enabled = true
> },
> };
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2022-06-07 6:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-06 10:10 [PATCH -next] evm: Use IS_ENABLED to initialize .enabled Xiu Jianfeng
2022-06-07 6:06 ` Ahmad Fatoum [this message]
2022-06-21 10:58 ` xiujianfeng
2022-06-21 14:03 ` Mimi Zohar
2022-06-22 2:17 ` Eric Biggers
2022-06-26 16:13 ` Mimi Zohar
2022-06-29 3:59 ` xiujianfeng
2022-07-07 23:15 ` Mimi Zohar
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=64511312-df94-c40b-689c-5fc3823e91f5@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=dmitry.kasatkin@gmail.com \
--cc=jmorris@namei.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=serge@hallyn.com \
--cc=xiujianfeng@huawei.com \
--cc=zohar@linux.ibm.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).