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

scsi: target: tcmu: Constify some structures

'struct nla_policy' and 'struct match_table_t' are not modified in this
driver.

Constifying these structures moves some data to a read-only section, so
increase overall security, especially when the structure holds some
function pointers, which is the case of struct nla_policy.

On a x86_64, with allmodconfig:
Before:
======
text data bss dec hex filename
93188 6933 338 100459 1886b drivers/target/target_core_user.o

After:
=====
text data bss dec hex filename
93508 6581 338 100427 1884b drivers/target/target_core_user.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/f83cd8469cc17391178e1181e8c26c4c1fb6028f.1731330634.git.christophe.jaillet@wanadoo.fr
Reviewed-by: Bodo Stroesser <bostroesser@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Christophe JAILLET and committed by
Martin K. Petersen
5cd3167a 50740f4d

+2 -2
+2 -2
drivers/target/target_core_user.c
··· 361 361 [TCMU_MCGRP_CONFIG] = { .name = "config", }, 362 362 }; 363 363 364 - static struct nla_policy tcmu_attr_policy[TCMU_ATTR_MAX+1] = { 364 + static const struct nla_policy tcmu_attr_policy[TCMU_ATTR_MAX + 1] = { 365 365 [TCMU_ATTR_DEVICE] = { .type = NLA_STRING }, 366 366 [TCMU_ATTR_MINOR] = { .type = NLA_U32 }, 367 367 [TCMU_ATTR_CMD_STATUS] = { .type = NLA_S32 }, ··· 2430 2430 Opt_cmd_ring_size_mb, Opt_err, 2431 2431 }; 2432 2432 2433 - static match_table_t tokens = { 2433 + static const match_table_t tokens = { 2434 2434 {Opt_dev_config, "dev_config=%s"}, 2435 2435 {Opt_dev_size, "dev_size=%s"}, 2436 2436 {Opt_hw_block_size, "hw_block_size=%d"},