From: Huang Xiaojia Date: Mon, 26 Aug 2024 15:12:50 +0000 (+0800) Subject: arm64: Constify struct kobj_type X-Git-Tag: v6.12-rc1~221^2~6^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=684fbd42d323c9c4a69a905451ea270678e36d1e;p=thirdparty%2Fkernel%2Flinux.git arm64: Constify struct kobj_type 'struct kobj_type' is not modified. It is only used in kobject_init() which takes a 'const struct kobj_type *ktype' parameter. Constifying this structure moves some data to a read-only section, so increase over all security. On a x86_64, compiled with arm defconfig: Before: ====== text data bss dec hex filename 5602 548 352 6502 1966 arch/arm64/kernel/cpuinfo.o After: ====== text data bss dec hex filename 5650 500 352 6502 1966 arch/arm64/kernel/cpuinfo.o Signed-off-by: Huang Xiaojia Link: https://lore.kernel.org/r/20240826151250.3500302-1-huangxiaojia2@huawei.com Signed-off-by: Will Deacon --- diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c index 09eeaa24d4560..369dd72a8b229 100644 --- a/arch/arm64/kernel/cpuinfo.c +++ b/arch/arm64/kernel/cpuinfo.c @@ -280,7 +280,7 @@ const struct seq_operations cpuinfo_op = { }; -static struct kobj_type cpuregs_kobj_type = { +static const struct kobj_type cpuregs_kobj_type = { .sysfs_ops = &kobj_sysfs_ops, };