From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751811AbdHAM0U (ORCPT ); Tue, 1 Aug 2017 08:26:20 -0400 Received: from terminus.zytor.com ([65.50.211.136]:33625 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751612AbdHAM0T (ORCPT ); Tue, 1 Aug 2017 08:26:19 -0400 Date: Tue, 1 Aug 2017 05:25:05 -0700 From: tip-bot for Matija Glavinic Pecotic Message-ID: Cc: tglx@linutronix.de, hpa@zytor.com, matija.glavinic-pecotic.ext@nokia.com, alexander.sverdlin@nokia.com, mingo@kernel.org, linux-kernel@vger.kernel.org Reply-To: tglx@linutronix.de, hpa@zytor.com, matija.glavinic-pecotic.ext@nokia.com, alexander.sverdlin@nokia.com, mingo@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: References: To: linux-tip-commits@vger.kernel.org Subject: [tip:timers/urgent] timers: Fix overflow in get_next_timer_interrupt Git-Commit-ID: 34f41c0316ed52b0b44542491d89278efdaa70e4 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 34f41c0316ed52b0b44542491d89278efdaa70e4 Gitweb: http://git.kernel.org/tip/34f41c0316ed52b0b44542491d89278efdaa70e4 Author: Matija Glavinic Pecotic AuthorDate: Tue, 1 Aug 2017 09:11:52 +0200 Committer: Thomas Gleixner CommitDate: Tue, 1 Aug 2017 14:20:53 +0200 timers: Fix overflow in get_next_timer_interrupt 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. Type cast the multiplier to 64bit to avoid that issue. Fixes: 46c8f0b077a8 ("timers: Fix get_next_timer_interrupt() computation") Signed-off-by: Matija Glavinic Pecotic Signed-off-by: Thomas Gleixner Reviewed-by: Alexander Sverdlin Cc: khilman@baylibre.com Cc: akpm@linux-foundation.org Cc: stable@vger.kernel.org Link: http://lkml.kernel.org/r/a7900f04-2a21-c9fd-67be-ab334d459ee5@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: */