Skip to content

Commit 1b47b80

Browse files
t-8chpmladek
authored andcommitted
livepatch: Make kobj_type structures constant
Since commit ee6d3dd ("driver core: make kobj_type constant.") the driver core allows the usage of const struct kobj_type. Take advantage of this to constify the structure definitions to prevent modification at runtime. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Reviewed-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Petr Mladek <pmladek@suse.com> Link: https://lore.kernel.org/r/20230217-kobj_type-livepatch-v1-1-06ded292e897@weissschuh.net
1 parent 7dd86cf commit 1b47b80

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kernel/livepatch/core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ static void klp_kobj_release_patch(struct kobject *kobj)
596596
complete(&patch->finish);
597597
}
598598

599-
static struct kobj_type klp_ktype_patch = {
599+
static const struct kobj_type klp_ktype_patch = {
600600
.release = klp_kobj_release_patch,
601601
.sysfs_ops = &kobj_sysfs_ops,
602602
.default_groups = klp_patch_groups,
@@ -612,7 +612,7 @@ static void klp_kobj_release_object(struct kobject *kobj)
612612
klp_free_object_dynamic(obj);
613613
}
614614

615-
static struct kobj_type klp_ktype_object = {
615+
static const struct kobj_type klp_ktype_object = {
616616
.release = klp_kobj_release_object,
617617
.sysfs_ops = &kobj_sysfs_ops,
618618
.default_groups = klp_object_groups,
@@ -628,7 +628,7 @@ static void klp_kobj_release_func(struct kobject *kobj)
628628
klp_free_func_nop(func);
629629
}
630630

631-
static struct kobj_type klp_ktype_func = {
631+
static const struct kobj_type klp_ktype_func = {
632632
.release = klp_kobj_release_func,
633633
.sysfs_ops = &kobj_sysfs_ops,
634634
};

0 commit comments

Comments
 (0)