From patchwork Sun Aug 11 09:30:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 13759718 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9A759C3DA4A for ; Sun, 11 Aug 2024 09:31:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=vH6776X2q6P6GBwTwVrFQw2I+W41yFf77V4n/US8fFg=; b=0avdkhVdJuZkZYdKineVMOAr3T BsxXGg+G098iVkss86SRVZ3sHZjDstoiSKgFr1JWWbi5PpKrfZj7+7mqKVdhX+mgywRHwwjx5NqsY qFmTHRng6PrSUOU7O1Dxr8yAoey7VO4Ux/7MnH2e068BjgTwH+qU64tmawkR1qeivEUO4xuXi5uHf dk5MtL/a2x53yb9FMHMH9rdEBavjRyWG/V/dFHPqtTFwzKCqj2lsmEi6wywkIyx0UD1zF3fg/7cjQ pkS9gW+M/bDBwucR3XrWq0e70GJenCBSC8CWJi7m4YvjdVEshNnn6ujC/tl56QQQRC6IU/+MhSoaN 0j4IuYfQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sd4ur-0000000FMsI-3iMp; Sun, 11 Aug 2024 09:31:10 +0000 Received: from smtp-30.smtpout.orange.fr ([80.12.242.30] helo=smtp.smtpout.orange.fr) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sd4uG-0000000FMoE-0kUL for linux-arm-kernel@lists.infradead.org; Sun, 11 Aug 2024 09:30:34 +0000 Received: from fedora.home ([90.11.132.44]) by smtp.orange.fr with ESMTPA id d4u8sXXQdPZ0yd4u8seuKK; Sun, 11 Aug 2024 11:30:27 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1723368627; bh=vH6776X2q6P6GBwTwVrFQw2I+W41yFf77V4n/US8fFg=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=ejLoU/KYvz82OqY5KPL8/I6MerFK5CJr+IDJ8AO8pJMYBsBZY85GrI80CGexz55SO 9FRMKvzSP9JNRVosZ8HCssAV35JOvIWm6ByRWNph0Q2xStJmen/CE6tCXx2DGOhwvd z1baL4vtT0en8xo3DKSMB8bRIAnoFu/7vRp1h0StPEXvfkqpcn8tqGV7oi9jT5e2Qw IV/s/PmaqC/46mIvRLk5lCZoLUm89Ez7rmSRLcnAWSPew8DWYvksX76ztfHCemvWv7 CtebWI4ee9kv/+AASqzrhR+cBgtSADI2bYKS0o2IHWuzdaX1ZlCLRd3VS1UmFGKAMn a+PdM02r/naSw== X-ME-Helo: fedora.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 11 Aug 2024 11:30:27 +0200 X-ME-IP: 90.11.132.44 From: Christophe JAILLET To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] coresight: configfs: Constify struct config_item_type Date: Sun, 11 Aug 2024 11:30:20 +0200 Message-ID: <1011717e5ed35ec12113a0d8c233823e820fb524.1723368522.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240811_023032_660356_753286EE X-CRM114-Status: GOOD ( 10.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 'struct config_item_type' is not modified in this driver. These structures are only used with config_group_init_type_name() which takes a "const struct config_item_type *" as a 3rd argument or with struct config_group.cg_item.ci_type which is also a "const struct config_item_type *". Constifying this structure moves some data to a read-only section, so increase overall security, especially when the structure holds some function pointers. On a x86_64, with allmodconfig: Before: ====== text data bss dec hex filename 4904 1376 136 6416 1910 drivers/hwtracing/coresight/coresight-syscfg-configfs.o After: ===== text data bss dec hex filename 5264 1120 16 6400 1900 drivers/hwtracing/coresight/coresight-syscfg-configfs.o Signed-off-by: Christophe JAILLET Reviewed-by: James Clark --- Compile tested-only. --- .../hwtracing/coresight/coresight-syscfg-configfs.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-syscfg-configfs.c b/drivers/hwtracing/coresight/coresight-syscfg-configfs.c index 433ede94dd63..213b4159b062 100644 --- a/drivers/hwtracing/coresight/coresight-syscfg-configfs.c +++ b/drivers/hwtracing/coresight/coresight-syscfg-configfs.c @@ -160,7 +160,7 @@ static struct configfs_attribute *cscfg_config_view_attrs[] = { NULL, }; -static struct config_item_type cscfg_config_view_type = { +static const struct config_item_type cscfg_config_view_type = { .ct_owner = THIS_MODULE, .ct_attrs = cscfg_config_view_attrs, }; @@ -170,7 +170,7 @@ static struct configfs_attribute *cscfg_config_preset_attrs[] = { NULL, }; -static struct config_item_type cscfg_config_preset_type = { +static const struct config_item_type cscfg_config_preset_type = { .ct_owner = THIS_MODULE, .ct_attrs = cscfg_config_preset_attrs, }; @@ -272,7 +272,7 @@ static struct configfs_attribute *cscfg_feature_view_attrs[] = { NULL, }; -static struct config_item_type cscfg_feature_view_type = { +static const struct config_item_type cscfg_feature_view_type = { .ct_owner = THIS_MODULE, .ct_attrs = cscfg_feature_view_attrs, }; @@ -309,7 +309,7 @@ static struct configfs_attribute *cscfg_param_view_attrs[] = { NULL, }; -static struct config_item_type cscfg_param_view_type = { +static const struct config_item_type cscfg_param_view_type = { .ct_owner = THIS_MODULE, .ct_attrs = cscfg_param_view_attrs, }; @@ -380,7 +380,7 @@ static struct config_group *cscfg_create_feature_group(struct cscfg_feature_desc return &feat_view->group; } -static struct config_item_type cscfg_configs_type = { +static const struct config_item_type cscfg_configs_type = { .ct_owner = THIS_MODULE, }; @@ -414,7 +414,7 @@ void cscfg_configfs_del_config(struct cscfg_config_desc *config_desc) } } -static struct config_item_type cscfg_features_type = { +static const struct config_item_type cscfg_features_type = { .ct_owner = THIS_MODULE, };