mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Sverdlin <alexander.sverdlin@nokia.com>
To: Matija Glavinic Pecotic <matija.glavinic-pecotic.ext@nokia.com>,
	<khilman@baylibre.com>, <tglx@linutronix.de>, <mingo@kernel.org>,
	<akpm@linux-foundation.org>, <hpa@zytor.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] timers: Fix overflow in get_next_timer_interrupt
Date: Tue, 1 Aug 2017 10:16:30 +0200	[thread overview]
Message-ID: <66d27e1f-5b57-aa75-bf46-91f0427b45be@nokia.com> (raw)
In-Reply-To: <a7900f04-2a21-c9fd-67be-ab334d459ee5@nokia.com>

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@nokia.com>

Reviewed-by: Alexander Sverdlin <alexander.sverdlin@nokia.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.

  reply	other threads:[~2017-08-01  8:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-01  7:11 Matija Glavinic Pecotic
2017-08-01  8:16 ` Alexander Sverdlin [this message]
2017-08-01 12:25 ` [tip:timers/urgent] " tip-bot for Matija Glavinic Pecotic

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=66d27e1f-5b57-aa75-bf46-91f0427b45be@nokia.com \
    --to=alexander.sverdlin@nokia.com \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=khilman@baylibre.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matija.glavinic-pecotic.ext@nokia.com \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®