Skip to content

Commit 6f26832

Browse files
hsiaoh2mpe
authored andcommitted
powerpc: pseries: 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 ppc64 defconfig: Before: ====== text data bss dec hex filename 1885 368 16 2269 8dd arch/powerpc/platforms/pseries/vas-sysfs.o After: ====== text data bss dec hex filename 1981 272 16 2269 8dd arch/powerpc/platforms/pseries/vas-sysfs.o Signed-off-by: Huang Xiaojia <huangxiaojia2@huawei.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20240826150957.3500237-3-huangxiaojia2@huawei.com
1 parent 7492ca3 commit 6f26832

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

arch/powerpc/platforms/pseries/vas-sysfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,13 @@ static const struct sysfs_ops vas_sysfs_ops = {
162162
.store = vas_type_store,
163163
};
164164

165-
static struct kobj_type vas_def_attr_type = {
165+
static const struct kobj_type vas_def_attr_type = {
166166
.release = vas_type_release,
167167
.sysfs_ops = &vas_sysfs_ops,
168168
.default_groups = vas_def_capab_groups,
169169
};
170170

171-
static struct kobj_type vas_qos_attr_type = {
171+
static const struct kobj_type vas_qos_attr_type = {
172172
.release = vas_type_release,
173173
.sysfs_ops = &vas_sysfs_ops,
174174
.default_groups = vas_qos_capab_groups,

0 commit comments

Comments
 (0)