blk-throttle: prevent overflow while calculating wait time
authorYu Kuai <yukuai3@huawei.com>
Mon, 29 Aug 2022 02:22:38 +0000 (10:22 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 10:35:47 +0000 (12:35 +0200)
commit70b2adb1d698fbc63d3b3848c452524dc15872c5
treed892fc22ad7e8d92632f63b26531cbf82a9a222c
parentff8551d411f12b5abc5ca929ab87643afa8a9588
blk-throttle: prevent overflow while calculating wait time

[ Upstream commit 8d6bbaada2e0a65f9012ac4c2506460160e7237a ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
block/blk-throttle.c