mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:24:47 +01:00
samples: configfs: Constify struct configfs_item_operations and configfs_group_operations
'struct configfs_item_operations' and 'configfs_group_operations' are not modified in this driver. Constifying these structures moves some data to a read-only section, so increases overall security, especially when the structure holds some function pointers. On a x86_64, with allmodconfig: Before: ====== text data bss dec hex filename 7507 6504 64 14075 36fb samples/configfs/configfs_sample.o After: ===== text data bss dec hex filename 7827 6184 64 14075 36fb samples/configfs/configfs_sample.o Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/70c5fd68fcc4d3ba1f18002012fae19acf4ce50b.1767007414.git.christophe.jaillet@wanadoo.fr Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
This commit is contained in:
parent
1d40cb05e0
commit
6363844fdb
1 changed files with 4 additions and 4 deletions
|
|
@ -158,7 +158,7 @@ static void simple_child_release(struct config_item *item)
|
|||
kfree(to_simple_child(item));
|
||||
}
|
||||
|
||||
static struct configfs_item_operations simple_child_item_ops = {
|
||||
static const struct configfs_item_operations simple_child_item_ops = {
|
||||
.release = simple_child_release,
|
||||
};
|
||||
|
||||
|
|
@ -215,7 +215,7 @@ static void simple_children_release(struct config_item *item)
|
|||
kfree(to_simple_children(item));
|
||||
}
|
||||
|
||||
static struct configfs_item_operations simple_children_item_ops = {
|
||||
static const struct configfs_item_operations simple_children_item_ops = {
|
||||
.release = simple_children_release,
|
||||
};
|
||||
|
||||
|
|
@ -223,7 +223,7 @@ static struct configfs_item_operations simple_children_item_ops = {
|
|||
* Note that, since no extra work is required on ->drop_item(),
|
||||
* no ->drop_item() is provided.
|
||||
*/
|
||||
static struct configfs_group_operations simple_children_group_ops = {
|
||||
static const struct configfs_group_operations simple_children_group_ops = {
|
||||
.make_item = simple_children_make_item,
|
||||
};
|
||||
|
||||
|
|
@ -292,7 +292,7 @@ static struct configfs_attribute *group_children_attrs[] = {
|
|||
* Note that, since no extra work is required on ->drop_item(),
|
||||
* no ->drop_item() is provided.
|
||||
*/
|
||||
static struct configfs_group_operations group_children_group_ops = {
|
||||
static const struct configfs_group_operations group_children_group_ops = {
|
||||
.make_group = group_children_make_group,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue