diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2024-07-14 09:13:56 +0200 |
---|---|---|
committer | Mikulas Patocka <mpatocka@redhat.com> | 2024-07-19 12:08:15 +0200 |
commit | 0b60be1628e3448fc96e28bde3d0b27e6d8743fc (patch) | |
tree | 3949b49b100115c6ed243f0247f5f9310fc1ec41 /drivers/md/dm-thin-metadata.c | |
parent | dm-integrity: introduce the Inline mode (diff) | |
download | linux-0b60be1628e3448fc96e28bde3d0b27e6d8743fc.tar.xz linux-0b60be1628e3448fc96e28bde3d0b27e6d8743fc.zip |
dm: Constify struct dm_block_validator
'struct dm_block_validator' are not modified in these drivers.
Constifying this structure moves some data to a read-only section, so
increase overall security.
On a x86_64, with allmodconfig, as an example:
Before:
======
text data bss dec hex filename
32047 920 16 32983 80d7 drivers/md/dm-cache-metadata.o
After:
=====
text data bss dec hex filename
32075 896 16 32987 80db drivers/md/dm-cache-metadata.o
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Diffstat (limited to 'drivers/md/dm-thin-metadata.c')
-rw-r--r-- | drivers/md/dm-thin-metadata.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c index 6022189c1388..f90679cfec5b 100644 --- a/drivers/md/dm-thin-metadata.c +++ b/drivers/md/dm-thin-metadata.c @@ -249,7 +249,7 @@ struct dm_thin_device { */ #define SUPERBLOCK_CSUM_XOR 160774 -static void sb_prepare_for_write(struct dm_block_validator *v, +static void sb_prepare_for_write(const struct dm_block_validator *v, struct dm_block *b, size_t block_size) { @@ -261,7 +261,7 @@ static void sb_prepare_for_write(struct dm_block_validator *v, SUPERBLOCK_CSUM_XOR)); } -static int sb_check(struct dm_block_validator *v, +static int sb_check(const struct dm_block_validator *v, struct dm_block *b, size_t block_size) { @@ -294,7 +294,7 @@ static int sb_check(struct dm_block_validator *v, return 0; } -static struct dm_block_validator sb_validator = { +static const struct dm_block_validator sb_validator = { .name = "superblock", .prepare_for_write = sb_prepare_for_write, .check = sb_check |