Skip to content

Commit 4a21d31

Browse files
Hongbo Limstsirkin
authored andcommitted
fw_cfg: Constify struct kobj_type
This 'struct kobj_type' is not modified. It is only used in kobject_init_and_add() which takes a 'const struct kobj_type *ktype' parameter. Constifying this structure and moving it to a read-only section, and this can increase over all security. ``` [Before] text data bss dec hex filename 5974 1008 96 7078 1ba6 drivers/firmware/qemu_fw_cfg.o [After] text data bss dec hex filename 6038 944 96 7078 1ba6 drivers/firmware/qemu_fw_cfg.o ``` Signed-off-by: Hongbo Li <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent 6211165 commit 4a21d31

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/firmware/qemu_fw_cfg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ static void fw_cfg_sysfs_release_entry(struct kobject *kobj)
452452
}
453453

454454
/* kobj_type: ties together all properties required to register an entry */
455-
static struct kobj_type fw_cfg_sysfs_entry_ktype = {
455+
static const struct kobj_type fw_cfg_sysfs_entry_ktype = {
456456
.default_groups = fw_cfg_sysfs_entry_groups,
457457
.sysfs_ops = &fw_cfg_sysfs_attr_ops,
458458
.release = fw_cfg_sysfs_release_entry,

0 commit comments

Comments
 (0)