Skip to content

Commit ba287d7

Browse files
mauelshaMike Snitzer
authored andcommitted
dm integrity: change macros min/max() -> min_t/max_t where appropriate
Signed-off-by: Heinz Mauelshagen <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
1 parent 8d1058f commit ba287d7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/md/dm-integrity.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,7 +1730,7 @@ static void integrity_metadata(struct work_struct *w)
17301730
struct bio *bio = dm_bio_from_per_bio_data(dio, sizeof(struct dm_integrity_io));
17311731
char *checksums;
17321732
unsigned int extra_space = unlikely(digest_size > ic->tag_size) ? digest_size - ic->tag_size : 0;
1733-
char checksums_onstack[max((size_t)HASH_MAX_DIGESTSIZE, MAX_TAG_SIZE)];
1733+
char checksums_onstack[max_t(size_t, HASH_MAX_DIGESTSIZE, MAX_TAG_SIZE)];
17341734
sector_t sector;
17351735
unsigned int sectors_to_process;
17361736

@@ -2015,7 +2015,7 @@ static bool __journal_read_write(struct dm_integrity_io *dio, struct bio *bio,
20152015
} while (++s < ic->sectors_per_block);
20162016
#ifdef INTERNAL_VERIFY
20172017
if (ic->internal_hash) {
2018-
char checksums_onstack[max((size_t)HASH_MAX_DIGESTSIZE, MAX_TAG_SIZE)];
2018+
char checksums_onstack[max_t(size_t, HASH_MAX_DIGESTSIZE, MAX_TAG_SIZE)];
20192019

20202020
integrity_sector_checksum(ic, logical_sector, mem + bv.bv_offset, checksums_onstack);
20212021
if (unlikely(memcmp(checksums_onstack, journal_entry_tag(ic, je), ic->tag_size))) {
@@ -3530,8 +3530,8 @@ static int initialize_superblock(struct dm_integrity_c *ic,
35303530
if (!interleave_sectors)
35313531
interleave_sectors = DEFAULT_INTERLEAVE_SECTORS;
35323532
ic->sb->log2_interleave_sectors = __fls(interleave_sectors);
3533-
ic->sb->log2_interleave_sectors = max((__u8)MIN_LOG2_INTERLEAVE_SECTORS, ic->sb->log2_interleave_sectors);
3534-
ic->sb->log2_interleave_sectors = min((__u8)MAX_LOG2_INTERLEAVE_SECTORS, ic->sb->log2_interleave_sectors);
3533+
ic->sb->log2_interleave_sectors = max_t(__u8, MIN_LOG2_INTERLEAVE_SECTORS, ic->sb->log2_interleave_sectors);
3534+
ic->sb->log2_interleave_sectors = min_t(__u8, MAX_LOG2_INTERLEAVE_SECTORS, ic->sb->log2_interleave_sectors);
35353535

35363536
get_provided_data_sectors(ic);
35373537
if (!ic->provided_data_sectors)
@@ -3921,7 +3921,7 @@ static int create_journal(struct dm_integrity_c *ic, char **error)
39213921

39223922
memset(crypt_iv, 0x00, ivsize);
39233923
memset(crypt_data, 0x00, crypt_len);
3924-
memcpy(crypt_data, &section_le, min((size_t)crypt_len, sizeof(section_le)));
3924+
memcpy(crypt_data, &section_le, min_t(size_t, crypt_len, sizeof(section_le)));
39253925

39263926
sg_init_one(&sg, crypt_data, crypt_len);
39273927
skcipher_request_set_crypt(req, &sg, &sg, crypt_len, crypt_iv);

0 commit comments

Comments
 (0)