mm: slub: make kobj_type structure constant
authorThomas Weißschuh <linux@weissschuh.net>
Mon, 20 Feb 2023 23:25:28 +0000 (23:25 +0000)
committerVlastimil Babka <vbabka@suse.cz>
Mon, 13 Mar 2023 16:21:13 +0000 (17:21 +0100)
Since commit ee6d3dd4ed48 ("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 definition to prevent
modification at runtime.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
mm/slub.c

index 39327e98fce347a7c7c4d55850d7850f8c468907..28ca576d988d8938b1794f12bff448c44f9e97f7 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -6059,7 +6059,7 @@ static const struct sysfs_ops slab_sysfs_ops = {
        .store = slab_attr_store,
 };
 
-static struct kobj_type slab_ktype = {
+static const struct kobj_type slab_ktype = {
        .sysfs_ops = &slab_sysfs_ops,
        .release = kmem_cache_release,
 };