From: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Li Jinlin <lijinlin3-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Cc: josef-DigfWCa+lFGyeJad7bwFQA@public.gmane.org,
axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org,
cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-block-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
liuzhiqiang26-hv44wF8Li93QT0dZR+AlfA@public.gmane.org
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-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
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
[not found] ` <20221128030413.882998-1-lijinlin3-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2022-11-28 19:58 ` Tejun Heo [this message]
[not found] ` <Y4US2vFmR4pnw08Z-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2022-11-29 1:14 ` Yu Kuai
2022-11-29 2:49 ` Li Jinlin
[not found] ` <2830bd58-0f53-fa54-58e5-e87225b1fdf1-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
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-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=josef-DigfWCa+lFGyeJad7bwFQA@public.gmane.org \
--cc=lijinlin3-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=linux-block-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=liuzhiqiang26-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
/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