Re: [PATCH] blk-throttle: check for overflow in calculate_bytes_allowed

From: Tejun Heo
Date: Fri Oct 20 2023 - 20:23:02 EST


On Fri, Oct 20, 2023 at 03:36:17PM -0700, Khazhismel Kumykov wrote:
> Inexact, we may reject some not-overflowing values incorrectly, but
> they'll be on the order of exabytes allowed anyways.
>
> This fixes divide error crash on x86 if bps_limit is not configured or
> is set too high in the rare case that jiffy_elapsed is greater than HZ.
>
> Fixes: e8368b57c006 ("blk-throttle: use calculate_io/bytes_allowed() for throtl_trim_slice()")
> Fixes: 8d6bbaada2e0 ("blk-throttle: prevent overflow while calculating wait time")
> Signed-off-by: Khazhismel Kumykov <khazhy@xxxxxxxxxx>

Acked-by: Tejun Heo <tj@xxxxxxxxxx>

Thanks.

--
tejun