diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 8e6174c..a1177e1 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1123,8 +1123,13 @@ struct clone_info { static void bio_setup_sector(struct bio *bio, sector_t sector, sector_t len) { - bio->bi_iter.bi_sector = sector; - bio->bi_iter.bi_size = to_bytes(len); + if (len) { + bio->bi_iter.bi_sector = sector; + bio->bi_iter.bi_size = to_bytes(len); + } else { + bio->bi_iter.bi_size = 0; + bio->bi_vcnt = 0; + } } /* @@ -1178,8 +1183,7 @@ static void __clone_and_map_simple_bio(struct clone_info *ci, * and discard, so no need for concern about wasted bvec allocations. */ __bio_clone(clone, ci->bio); - if (len) - bio_setup_sector(clone, ci->sector, len); + bio_setup_sector(clone, ci->sector, len); __map_bio(tio); }