mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
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>
This commit is contained in:
committed by
Mikulas Patocka
parent
fb0987682c
commit
0b60be1628
@@ -38,7 +38,7 @@ struct array_block {
|
||||
*/
|
||||
#define CSUM_XOR 595846735
|
||||
|
||||
static void array_block_prepare_for_write(struct dm_block_validator *v,
|
||||
static void array_block_prepare_for_write(const struct dm_block_validator *v,
|
||||
struct dm_block *b,
|
||||
size_t size_of_block)
|
||||
{
|
||||
@@ -50,7 +50,7 @@ static void array_block_prepare_for_write(struct dm_block_validator *v,
|
||||
CSUM_XOR));
|
||||
}
|
||||
|
||||
static int array_block_check(struct dm_block_validator *v,
|
||||
static int array_block_check(const struct dm_block_validator *v,
|
||||
struct dm_block *b,
|
||||
size_t size_of_block)
|
||||
{
|
||||
@@ -77,7 +77,7 @@ static int array_block_check(struct dm_block_validator *v,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dm_block_validator array_validator = {
|
||||
static const struct dm_block_validator array_validator = {
|
||||
.name = "array",
|
||||
.prepare_for_write = array_block_prepare_for_write,
|
||||
.check = array_block_check
|
||||
|
||||
Reference in New Issue
Block a user