[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y4US2vFmR4pnw08Z@slm.duckdns.org>
Date: Mon, 28 Nov 2022 09:58:18 -1000
From: Tejun Heo <tj@...nel.org>
To: Li Jinlin <lijinlin3@...wei.com>
Cc: josef@...icpanda.com, axboe@...nel.dk, cgroups@...r.kernel.org,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
liuzhiqiang26@...wei.com
Subject: Re: [PATCH v2] blk-iocost: fix shift-out-of-bounds in
iocg_hick_delay()
On Mon, Nov 28, 2022 at 11:04:13AM +0800, Li Jinlin wrote:
> /* calculate the current delay in effect - 1/2 every second */
> tdelta = now->now - iocg->delay_at;
> if (iocg->delay)
> - delay = iocg->delay >> div64_u64(tdelta, USEC_PER_SEC);
> + delay = iocg->delay >>
> + min_t(u64, div64_u64(tdelta, USEC_PER_SEC), 63);
I replied earlier but the right thing to do here is setting delay to 0 if
the shift is >= 64.
Thanks.
--
tejun
Powered by blists - more mailing lists