]> www.infradead.org Git - linux.git/commitdiff
cxl: Constify struct kobj_type
authorHongbo Li <lihongbo22@huawei.com>
Wed, 4 Sep 2024 01:19:51 +0000 (09:19 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 11 Sep 2024 14:02:50 +0000 (16:02 +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>
Link: https://lore.kernel.org/r/20240904011951.2010646-1-lihongbo22@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/cxl/sysfs.c

index 315c43f17dd3e59db88dea100b43811b8ee99774..409bd1c39663159a0d11c3ccba2aa5a8451baa34 100644 (file)
@@ -579,7 +579,7 @@ static void release_afu_config_record(struct kobject *kobj)
        kfree(cr);
 }
 
-static struct kobj_type afu_config_record_type = {
+static const struct kobj_type afu_config_record_type = {
        .sysfs_ops = &kobj_sysfs_ops,
        .release = release_afu_config_record,
        .default_groups = afu_cr_groups,