Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cxl: 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 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>

authored by

Hongbo Li and committed by
Greg Kroah-Hartman
5c09cfa5 e9e46ed2

+1 -1
+1 -1
drivers/misc/cxl/sysfs.c
··· 579 579 kfree(cr); 580 580 } 581 581 582 - static struct kobj_type afu_config_record_type = { 582 + static const struct kobj_type afu_config_record_type = { 583 583 .sysfs_ops = &kobj_sysfs_ops, 584 584 .release = release_afu_config_record, 585 585 .default_groups = afu_cr_groups,