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

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 <lihongbo22@huawei.com>
Link: https://lore.kernel.org/r/20240904012200.2010916-1-lihongbo22@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Hongbo Li and committed by
Greg Kroah-Hartman
89ec686a 5c09cfa5

+2 -2
+2 -2
drivers/uio/uio.c
··· 118 118 .show = map_type_show, 119 119 }; 120 120 121 - static struct kobj_type map_attr_type = { 121 + static const struct kobj_type map_attr_type = { 122 122 .release = map_release, 123 123 .sysfs_ops = &map_sysfs_ops, 124 124 .default_groups = map_groups, ··· 207 207 .show = portio_type_show, 208 208 }; 209 209 210 - static struct kobj_type portio_attr_type = { 210 + static const struct kobj_type portio_attr_type = { 211 211 .release = portio_release, 212 212 .sysfs_ops = &portio_sysfs_ops, 213 213 .default_groups = portio_groups,