mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Clark <james.clark@linaro.org>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	"coresight@lists.linaro.org" <coresight@lists.linaro.org>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Mike Leach <mike.leach@linaro.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>
Subject: Re: [PATCH] coresight: configfs: Constify struct config_item_type
Date: Wed, 12 Mar 2025 10:46:50 +0000	[thread overview]
Message-ID: <bed04866-a477-498a-b33a-a631759733e2@linaro.org> (raw)
In-Reply-To: <d8164311-83e7-4fb0-ab82-90e1a2762b01@linaro.org>



On 12/08/2024 10:12 am, James Clark wrote:
> 
> 
> On 11/08/2024 10:30 am, Christophe JAILLET wrote:
>> '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 <christophe.jaillet@wanadoo.fr>
>> ---
>> 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,
>>   };
> 
> Reviewed-by: James Clark <james.clark@linaro.org>

Ping. Just found this one hanging in my coresight branch. Still applies 
cleanly.

Thanks


  reply	other threads:[~2025-03-12 10:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-11  9:30 Christophe JAILLET
2024-08-12  9:12 ` James Clark
2025-03-12 10:46   ` James Clark [this message]
2025-03-12 11:04 ` Suzuki K Poulose

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=bed04866-a477-498a-b33a-a631759733e2@linaro.org \
    --to=james.clark@linaro.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=coresight@lists.linaro.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.leach@linaro.org \
    --cc=suzuki.poulose@arm.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

all inboxes | Powered by JetHome®