]> git.hungrycats.org Git - linux/commit
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>
Mon, 24 Oct 2022 07:58:25 +0000 (09:58 +0200)
commitcc6f0855bf8d9b729df28ff443ced7350c380dbd
tree508f9c961f1b92ec091b7f8a5cf7ad383d022334
parentfb5f569bcda8f87bd47d8030bfae343d757fa3ea
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