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

firmware: memmap: Constify memmap_ktype

This 'memmap_ktype' is not modified. It is only used in
firmware_map_add_entry().

Constifying this structure and moving it to a read-only section,
and this can increase over all security.

```
[Before]
text data bss dec hex filename
4345 596 12 4953 1359 drivers/firmware/memmap.o

[After]
text data bss dec hex filename
4393 548 12 4953 1359 drivers/firmware/memmap.o
```

Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Link: https://lore.kernel.org/r/20240924030533.34407-1-chentao@kylinos.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Kunwu Chan and committed by
Greg Kroah-Hartman
619325ca a27b406a

+1 -1
+1 -1
drivers/firmware/memmap.c
··· 116 116 kfree(entry); 117 117 } 118 118 119 - static struct kobj_type __refdata memmap_ktype = { 119 + static const struct kobj_type memmap_ktype = { 120 120 .release = release_firmware_map_entry, 121 121 .sysfs_ops = &memmap_attr_ops, 122 122 .default_groups = def_groups,