Re: [PATCH] ratelimit: restrict the delay time to a non-negative value

2022-09-23 Thread Markus Armbruster
Alberto Garcia writes: > On Wed 21 Sep 2022 09:47:32 AM +08, Wang Liang wrote: >>> > -return limit->slice_end_time - now; >>> > +return MAX(limit->slice_end_time - now, 0); >>> >>> How can this be negative? slice_end_time is guaranteed to be larger >>> than >>> now: >>> >>> if

Re: [PATCH] ratelimit: restrict the delay time to a non-negative value

2022-09-21 Thread Alberto Garcia
On Wed 21 Sep 2022 09:47:32 AM +08, Wang Liang wrote: >> > -return limit->slice_end_time - now; >> > +return MAX(limit->slice_end_time - now, 0); >> >> How can this be negative? slice_end_time is guaranteed to be larger >> than >> now: >> >> if (limit->slice_end_time < now) { >>

Re: [PATCH] ratelimit: restrict the delay time to a non-negative value

2022-09-21 Thread Wang Liang
On Wed, 2022-09-21 at 06:53 +0200, Markus Armbruster wrote: > Wang Liang writes: > > > On Tue, 2022-09-20 at 13:18 +, Alberto Garcia wrote: > > > On Tue 20 Sep 2022 08:33:50 PM +08, wanglian...@126.com wrote: > > > > From: Wang Liang > > > > > > > > The delay time should never be a

Re: [PATCH] ratelimit: restrict the delay time to a non-negative value

2022-09-20 Thread Markus Armbruster
Wang Liang writes: > On Tue, 2022-09-20 at 13:18 +, Alberto Garcia wrote: >> On Tue 20 Sep 2022 08:33:50 PM +08, wanglian...@126.com wrote: >> > From: Wang Liang >> > >> > The delay time should never be a negative value. >> > >> > -return limit->slice_end_time - now; >> > +return

Re: [PATCH] ratelimit: restrict the delay time to a non-negative value

2022-09-20 Thread Wang Liang
On Tue, 2022-09-20 at 13:18 +, Alberto Garcia wrote: > On Tue 20 Sep 2022 08:33:50 PM +08, wanglian...@126.com wrote: > > From: Wang Liang > > > > The delay time should never be a negative value. > > > > -return limit->slice_end_time - now; > > +return MAX(limit->slice_end_time -

Re: [PATCH] ratelimit: restrict the delay time to a non-negative value

2022-09-20 Thread Alberto Garcia
On Tue 20 Sep 2022 08:33:50 PM +08, wanglian...@126.com wrote: > From: Wang Liang > > The delay time should never be a negative value. > > -return limit->slice_end_time - now; > +return MAX(limit->slice_end_time - now, 0); How can this be negative? slice_end_time is guaranteed to be

[PATCH] ratelimit: restrict the delay time to a non-negative value

2022-09-20 Thread wangliangzz
From: Wang Liang The delay time should never be a negative value. Signed-off-by: Wang Liang --- include/qemu/ratelimit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/qemu/ratelimit.h b/include/qemu/ratelimit.h index 48bf59e857..c8ea855fc1 100644 ---