Skip to content

Commit 89ec686

Browse files
Hongbo Ligregkh
authored andcommitted
uio: Constify struct kobj_type
These 'struct kobj_type' are not modified. They are only used in kobject_init() which takes a 'const struct kobj_type *ktype' parameter. Constifying these structure and moving them to a read-only section (from data to text), and can increase over all security. ``` [Before] text data bss dec hex filename 10330 1908 20 12258 2fe2 drivers/uio/uio.o [After] text data bss dec hex filename 10458 1844 20 12322 3022 drivers/uio/uio.o ``` Signed-off-by: Hongbo Li <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 5c09cfa commit 89ec686

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/uio/uio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ static const struct sysfs_ops map_sysfs_ops = {
118118
.show = map_type_show,
119119
};
120120

121-
static struct kobj_type map_attr_type = {
121+
static const struct kobj_type map_attr_type = {
122122
.release = map_release,
123123
.sysfs_ops = &map_sysfs_ops,
124124
.default_groups = map_groups,
@@ -207,7 +207,7 @@ static const struct sysfs_ops portio_sysfs_ops = {
207207
.show = portio_type_show,
208208
};
209209

210-
static struct kobj_type portio_attr_type = {
210+
static const struct kobj_type portio_attr_type = {
211211
.release = portio_release,
212212
.sysfs_ops = &portio_sysfs_ops,
213213
.default_groups = portio_groups,

0 commit comments

Comments
 (0)