blk-throttle: prevent overflow while calculating wait time
authorYu Kuai <yukuai3@huawei.com>
Mon, 29 Aug 2022 02:22:38 +0000 (10:22 +0800)
committerJens Axboe <axboe@kernel.dk>
Mon, 12 Sep 2022 06:19:48 +0000 (00:19 -0600)
commit8d6bbaada2e0a65f9012ac4c2506460160e7237a
tree38f8337cf068641d2680da5e44e522b68b0f3434
parent320fb0f91e55ba248d4bad106b408e59099cfa89
blk-throttle: prevent overflow while calculating wait time

There is a problem found by code review in tg_with_in_bps_limit() that
'bps_limit * jiffy_elapsed_rnd' might overflow. Fix the problem by
calling mul_u64_u64_div_u64() instead.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/r/20220829022240.3348319-3-yukuai1@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-throttle.c