From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 927ACCCA473 for ; Tue, 21 Jun 2022 10:58:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348884AbiFUK6z (ORCPT ); Tue, 21 Jun 2022 06:58:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346528AbiFUK6x (ORCPT ); Tue, 21 Jun 2022 06:58:53 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C82242981D; Tue, 21 Jun 2022 03:58:51 -0700 (PDT) Received: from dggpeml500023.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4LS3ML2BchzSh03; Tue, 21 Jun 2022 18:55:26 +0800 (CST) Received: from [10.67.110.112] (10.67.110.112) by dggpeml500023.china.huawei.com (7.185.36.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 21 Jun 2022 18:58:49 +0800 Subject: Re: [PATCH -next] evm: Use IS_ENABLED to initialize .enabled To: Ahmad Fatoum , , , , CC: , , References: <20220606101042.89638-1-xiujianfeng@huawei.com> <64511312-df94-c40b-689c-5fc3823e91f5@pengutronix.de> From: xiujianfeng Message-ID: <812c4ee9-56f7-900a-df48-f3ca3e15542f@huawei.com> Date: Tue, 21 Jun 2022 18:58:49 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: <64511312-df94-c40b-689c-5fc3823e91f5@pengutronix.de> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.110.112] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpeml500023.china.huawei.com (7.185.36.114) X-CFilter-Loop: Reflected Precedence: bulk List-ID: Hi, Ahmad 在 2022/6/7 14:06, Ahmad Fatoum 写道: > 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 > Reviewed-by: Ahmad Fatoum thank you for the review, and I'm not sure if this patch has been picked, so frendly ping here... >> --- >> 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 >> }, >> }; >