Skip to content

Commit 2f8c28d

Browse files
Hou TaoMikulas Patocka
authored andcommitted
dm-crypt: use bi_sector in bio when initialize integrity seed
bio->bi_iter.bi_sector has already been initialized when initialize the integrity seed in dm_crypt_integrity_io_alloc(). There is no need to calculate it again. Therefore, use the helper bip_set_seed() to initialize the seed and pass bi_iter.bi_sector to it instead. Mikulas: We can't use bip_set_seed because it doesn't compile without CONFIG_BLK_DEV_INTEGRITY. Signed-off-by: Hou Tao <[email protected]> Signed-off-by: Mikulas Patocka <[email protected]>
1 parent 7c88f7c commit 2f8c28d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/md/dm-crypt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,7 @@ static int dm_crypt_integrity_io_alloc(struct dm_crypt_io *io, struct bio *bio)
11871187

11881188
tag_len = io->cc->tuple_size * (bio_sectors(bio) >> io->cc->sector_shift);
11891189

1190-
bip->bip_iter.bi_sector = io->cc->start + io->sector;
1190+
bip->bip_iter.bi_sector = bio->bi_iter.bi_sector;
11911191

11921192
ret = bio_integrity_add_page(bio, virt_to_page(io->integrity_metadata),
11931193
tag_len, offset_in_page(io->integrity_metadata));

0 commit comments

Comments
 (0)