From: Tejun Heo <tj@kernel.org>
To: Li Jinlin <lijinlin3@huawei.com>
Cc: josef@toxicpanda.com, axboe@kernel.dk, cgroups@vger.kernel.org,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
liuzhiqiang26@huawei.com
Subject: Re: [PATCH v2] blk-iocost: fix shift-out-of-bounds in iocg_hick_delay()
Date: Mon, 28 Nov 2022 09:58:18 -1000 [thread overview]
Message-ID: <Y4US2vFmR4pnw08Z@slm.duckdns.org> (raw)
In-Reply-To: <20221128030413.882998-1-lijinlin3@huawei.com>
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
next prev parent reply other threads:[~2022-11-28 19:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-28 3:04 [PATCH v2] blk-iocost: fix shift-out-of-bounds in iocg_hick_delay() Li Jinlin
2022-11-28 19:58 ` Tejun Heo [this message]
2022-11-29 1:14 ` Yu Kuai
2022-11-29 2:49 ` Li Jinlin
2022-11-29 2:59 ` Yu Kuai
2022-11-29 4:52 ` Li Jinlin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y4US2vFmR4pnw08Z@slm.duckdns.org \
--to=tj@kernel.org \
--cc=axboe@kernel.dk \
--cc=cgroups@vger.kernel.org \
--cc=josef@toxicpanda.com \
--cc=lijinlin3@huawei.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuzhiqiang26@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox