[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <66d27e1f-5b57-aa75-bf46-91f0427b45be@nokia.com>
Date: Tue, 1 Aug 2017 10:16:30 +0200
From: Alexander Sverdlin <alexander.sverdlin@...ia.com>
To: Matija Glavinic Pecotic <matija.glavinic-pecotic.ext@...ia.com>,
<khilman@...libre.com>, <tglx@...utronix.de>, <mingo@...nel.org>,
<akpm@...ux-foundation.org>, <hpa@...or.com>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] timers: Fix overflow in get_next_timer_interrupt
On 01/08/17 09:11, Matija Glavinic Pecotic wrote:
> For e.g. HZ=100, timer being 430 jiffies in the future, and 32 bit
> unsigned int, there is an overflow on unsigned int right-hand side
> of the expression which results with wrong values being returned.
>
> Problem was observed on tickless core and with following applied:
>
> sched/nohz: add debugfs control over sched_tick_max_deferment
> https://lkml.org/lkml/2013/9/16/499
>
> Signed-off-by: Matija Glavinic Pecotic <matija.glavinic-pecotic.ext@...ia.com>
Reviewed-by: Alexander Sverdlin <alexander.sverdlin@...ia.com>
> ---
> kernel/time/timer.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/time/timer.c b/kernel/time/timer.c
> index 71ce3f4..8f5d1bf 100644
> --- a/kernel/time/timer.c
> +++ b/kernel/time/timer.c
> @@ -1495,7 +1495,7 @@ u64 get_next_timer_interrupt(unsigned long basej, u64 basem)
> base->is_idle = false;
> } else {
> if (!is_max_delta)
> - expires = basem + (nextevt - basej) * TICK_NSEC;
> + expires = basem + (u64)(nextevt - basej) * TICK_NSEC;
> /*
> * If we expect to sleep more than a tick, mark the base idle:
> */
--
Best regards,
Alexander Sverdlin.
Powered by blists - more mailing lists