Skip to content

Commit ed4290f

Browse files
tititiou36kuba-moo
authored andcommitted
net: netconsole: Constify struct config_item_type
'struct config_item_type' is not modified in this driver. This structure is only used with config_group_init_type_name() which takes a const struct config_item_type* as a 3rd argument. This also makes things consistent with 'netconsole_target_type' witch is already const. 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 33007 3952 1312 38271 957f drivers/net/netconsole.o After: ===== text data bss dec hex filename 33071 3888 1312 38271 957f drivers/net/netconsole.o Signed-off-by: Christophe JAILLET <[email protected]> Reviewed-by: Breno Leitao <[email protected]> Link: https://patch.msgid.link/9c205b2b4bdb09fc9e9d2cb2f2936ec053da1b1b.1723325900.git.christophe.jaillet@wanadoo.fr Signed-off-by: Jakub Kicinski <[email protected]>
1 parent ac8c97b commit ed4290f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/netconsole.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ static struct configfs_group_operations userdata_ops = {
825825
.drop_item = userdatum_drop,
826826
};
827827

828-
static struct config_item_type userdata_type = {
828+
static const struct config_item_type userdata_type = {
829829
.ct_item_ops = &userdatum_ops,
830830
.ct_group_ops = &userdata_ops,
831831
.ct_attrs = userdata_attrs,

0 commit comments

Comments
 (0)