Message ID | 158039600260.4465.8760113992408208442.stgit@buzz (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v4.19,1/2] block: cleanup __blkdev_issue_discard() | expand |
diff --git a/block/blk-lib.c b/block/blk-lib.c index 41088d5466c1..0dbc9e2ab9a3 100644 --- a/block/blk-lib.c +++ b/block/blk-lib.c @@ -56,9 +56,11 @@ int __blkdev_issue_discard(struct block_device *bdev, sector_t sector, return -EINVAL; while (nr_sects) { - unsigned int req_sects = min_t(unsigned int, nr_sects, + sector_t req_sects = min_t(sector_t, nr_sects, bio_allowed_max_sectors(q)); + WARN_ON_ONCE((req_sects << 9) > UINT_MAX); + bio = next_bio(bio, 0, gfp_mask); bio->bi_iter.bi_sector = sector; bio_set_dev(bio, bdev);