parisc: pdc_stable: Constify struct kobj_type
authorHongbo Li <lihongbo22@huawei.com>
Wed, 4 Sep 2024 01:16:42 +0000 (09:16 +0800)
committerHelge Deller <deller@gmx.de>
Mon, 9 Sep 2024 06:53:17 +0000 (08:53 +0200)
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 can increase over all security.

Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
Signed-off-by: Helge Deller <deller@gmx.de>
drivers/parisc/pdc_stable.c

index 633266447e2ffa2fa40ed68f8acfd3307381e7af..16f4496bca951117a51f2cc2f4db664723b1aab7 100644 (file)
@@ -483,7 +483,7 @@ static struct attribute *paths_subsys_attrs[] = {
 ATTRIBUTE_GROUPS(paths_subsys);
 
 /* Specific kobject type for our PDC paths */
-static struct kobj_type ktype_pdcspath = {
+static const struct kobj_type ktype_pdcspath = {
        .sysfs_ops = &pdcspath_attr_ops,
        .default_groups = paths_subsys_groups,
 };