linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for John Stultz <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, mingo@kernel.org,
	john.stultz@linaro.org, prarit@redhat.com,
	richardcochran@gmail.com, tglx@linutronix.de, hpa@zytor.com
Subject: [tip:timers/urgent] clocksource: Fix abs() usage w/ 64bit values
Date: Fri, 2 Oct 2015 13:57:37 -0700	[thread overview]
Message-ID: <tip-67dfae0cd72fec5cd158b6e5fb1647b7dbe0834c@git.kernel.org> (raw)
In-Reply-To: <1442279124-7309-2-git-send-email-john.stultz@linaro.org>

Commit-ID:  67dfae0cd72fec5cd158b6e5fb1647b7dbe0834c
Gitweb:     http://git.kernel.org/tip/67dfae0cd72fec5cd158b6e5fb1647b7dbe0834c
Author:     John Stultz <john.stultz@linaro.org>
AuthorDate: Mon, 14 Sep 2015 18:05:20 -0700
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 2 Oct 2015 22:53:01 +0200

clocksource: Fix abs() usage w/ 64bit values

This patch fixes one cases where abs() was being used with 64-bit
nanosecond values, where the result may be capped at 32-bits.

This potentially could cause watchdog false negatives on 32-bit
systems, so this patch addresses the issue by using abs64().

Signed-off-by: John Stultz <john.stultz@linaro.org>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/1442279124-7309-2-git-send-email-john.stultz@linaro.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/time/clocksource.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 841b72f..3a38775 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -217,7 +217,7 @@ static void clocksource_watchdog(unsigned long data)
 			continue;
 
 		/* Check the deviation from the watchdog clocksource. */
-		if ((abs(cs_nsec - wd_nsec) > WATCHDOG_THRESHOLD)) {
+		if (abs64(cs_nsec - wd_nsec) > WATCHDOG_THRESHOLD) {
 			pr_warn("timekeeping watchdog: Marking clocksource '%s' as unstable because the skew is too large:\n",
 				cs->name);
 			pr_warn("                      '%s' wd_now: %llx wd_last: %llx mask: %llx\n",

  reply	other threads:[~2015-10-02 20:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-15  1:05 [RFC][PATCH 0/5] Fixes for abs() usage on 64bit values John Stultz
2015-09-15  1:05 ` [RFC][PATCH 1/5] clocksource: Fix abs() usage w/ " John Stultz
2015-10-02 20:57   ` tip-bot for John Stultz [this message]
2015-09-15  1:05 ` [RFC][PATCH 2/5] time: Fix abs() usage with 64-bit values John Stultz
2015-09-15  1:05 ` [RFC][PATCH 3/5] ext4: Fix abs() usage in ext4_mb_check_group_pa John Stultz
2015-09-15  1:05 ` [RFC][PATCH 4/5] percpu: Fix abs() usage in percpu_counter_compare() John Stultz
2015-09-15  1:05 ` [RFC][PATCH 5/5] abs(): Provide build error on passing 64bit value to abs() John Stultz
2015-09-15  5:22   ` Ingo Molnar
2015-09-15 23:52     ` Linus Torvalds
2015-09-16 12:57       ` [PATCH] kernel.h: make abs() work with 64-bit types Michal Nazarewicz
2015-09-18  3:12         ` John Stultz
2015-09-15  1:49 ` [RFC][PATCH 0/5] Fixes for abs() usage on 64bit values Tejun Heo
2015-09-15  3:27   ` John Stultz
2015-09-15  3:46     ` Tejun Heo
2015-09-15 12:09       ` Jeff Epler
2015-09-15 21:21       ` Andrew Morton
2015-09-15 22:54         ` Michal Nazarewicz
2015-09-15  5:20     ` Ingo Molnar
2015-09-15 23:43       ` Linus Torvalds

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=tip-67dfae0cd72fec5cd158b6e5fb1647b7dbe0834c@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=hpa@zytor.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=prarit@redhat.com \
    --cc=richardcochran@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).