Skip to content

Commit b5060c1

Browse files
tititiou36Suzuki K Poulose
authored andcommitted
coresight: configfs: Constify struct config_item_type
'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 <[email protected]> Reviewed-by: James Clark <[email protected]> Signed-off-by: Suzuki K Poulose <[email protected]> Link: https://lore.kernel.org/r/1011717e5ed35ec12113a0d8c233823e820fb524.1723368522.git.christophe.jaillet@wanadoo.fr
1 parent 4a29fa2 commit b5060c1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/hwtracing/coresight/coresight-syscfg-configfs.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ static struct configfs_attribute *cscfg_config_view_attrs[] = {
160160
NULL,
161161
};
162162

163-
static struct config_item_type cscfg_config_view_type = {
163+
static const struct config_item_type cscfg_config_view_type = {
164164
.ct_owner = THIS_MODULE,
165165
.ct_attrs = cscfg_config_view_attrs,
166166
};
@@ -170,7 +170,7 @@ static struct configfs_attribute *cscfg_config_preset_attrs[] = {
170170
NULL,
171171
};
172172

173-
static struct config_item_type cscfg_config_preset_type = {
173+
static const struct config_item_type cscfg_config_preset_type = {
174174
.ct_owner = THIS_MODULE,
175175
.ct_attrs = cscfg_config_preset_attrs,
176176
};
@@ -272,7 +272,7 @@ static struct configfs_attribute *cscfg_feature_view_attrs[] = {
272272
NULL,
273273
};
274274

275-
static struct config_item_type cscfg_feature_view_type = {
275+
static const struct config_item_type cscfg_feature_view_type = {
276276
.ct_owner = THIS_MODULE,
277277
.ct_attrs = cscfg_feature_view_attrs,
278278
};
@@ -309,7 +309,7 @@ static struct configfs_attribute *cscfg_param_view_attrs[] = {
309309
NULL,
310310
};
311311

312-
static struct config_item_type cscfg_param_view_type = {
312+
static const struct config_item_type cscfg_param_view_type = {
313313
.ct_owner = THIS_MODULE,
314314
.ct_attrs = cscfg_param_view_attrs,
315315
};
@@ -380,7 +380,7 @@ static struct config_group *cscfg_create_feature_group(struct cscfg_feature_desc
380380
return &feat_view->group;
381381
}
382382

383-
static struct config_item_type cscfg_configs_type = {
383+
static const struct config_item_type cscfg_configs_type = {
384384
.ct_owner = THIS_MODULE,
385385
};
386386

@@ -414,7 +414,7 @@ void cscfg_configfs_del_config(struct cscfg_config_desc *config_desc)
414414
}
415415
}
416416

417-
static struct config_item_type cscfg_features_type = {
417+
static const struct config_item_type cscfg_features_type = {
418418
.ct_owner = THIS_MODULE,
419419
};
420420

0 commit comments

Comments
 (0)