Skip to content

Commit 684fbd4

Browse files
hsiaoh2willdeacon
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent fdfa588 commit 684fbd4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/arm64/kernel/cpuinfo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ const struct seq_operations cpuinfo_op = {
280280
};
281281

282282

283-
static struct kobj_type cpuregs_kobj_type = {
283+
static const struct kobj_type cpuregs_kobj_type = {
284284
.sysfs_ops = &kobj_sysfs_ops,
285285
};
286286

0 commit comments

Comments
 (0)