'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, as an example: Before: ====== text data bss dec hex filename 16339 11001 384 27724 6c4c kernel/crash_dump_dm_crypt.o After: ===== text data bss dec hex filename 16499 10841 384 27724 6c4c kernel/crash_dump_dm_crypt.o
Showing the changes to kernel/crash_dump_dm_crypt.c (1 of 1 file). Show all
Unified · Split
| @@ -223,7 +223,7 @@ static void config_key_release(struct config_item *item) · 222 unmodified lines | |||
| 223 | key_count--; | 223 | key_count--; |
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | static struct configfs_item_operations config_key_item_ops = { | 226 | static const struct configfs_item_operations config_key_item_ops = { |
| 227 | .release = config_key_release, | 227 | .release = config_key_release, |
| 228 | }; | 228 | }; |
| 229 | 229 | ||
| @@ -298,7 +298,7 @@ static struct configfs_attribute *config_keys_attrs[] = { · 68 unmodified lines | |||
| 298 | * Note that, since no extra work is required on ->drop_item(), | 298 | * Note that, since no extra work is required on ->drop_item(), |
| 299 | * no ->drop_item() is provided. | 299 | * no ->drop_item() is provided. |
| 300 | */ | 300 | */ |
| 301 | static struct configfs_group_operations config_keys_group_ops = { | 301 | static const struct configfs_group_operations config_keys_group_ops = { |
| 302 | .make_item = config_keys_make_item, | 302 | .make_item = config_keys_make_item, |
| 303 | }; | 303 | }; |
| 304 | 304 | ||