From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752168AbbIOBFm (ORCPT ); Mon, 14 Sep 2015 21:05:42 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:35678 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751908AbbIOBFe (ORCPT ); Mon, 14 Sep 2015 21:05:34 -0400 From: John Stultz To: LKML Cc: John Stultz , Prarit Bhargava , Richard Cochran , Ingo Molnar , Thomas Gleixner Subject: [RFC][PATCH 2/5] time: Fix abs() usage with 64-bit values. Date: Mon, 14 Sep 2015 18:05:21 -0700 Message-Id: <1442279124-7309-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1442279124-7309-1-git-send-email-john.stultz@linaro.org> References: <1442279124-7309-1-git-send-email-john.stultz@linaro.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch fixes a usage of abs() with a 64-bit value which could truncate the result to 32-bits, by replacing it with abs64(). In this case, its unlikely any issue could have been caused by this, since we're calculating a second delta, which wouldn't be larger then 32-bit. Cc: Prarit Bhargava Cc: Richard Cochran Cc: Ingo Molnar Cc: Thomas Gleixner Signed-off-by: John Stultz --- kernel/time/timekeeping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 3739ac6..3172823f 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1464,7 +1464,7 @@ int timekeeping_suspend(void) */ delta = timespec64_sub(tk_xtime(tk), timekeeping_suspend_time); delta_delta = timespec64_sub(delta, old_delta); - if (abs(delta_delta.tv_sec) >= 2) { + if (abs64(delta_delta.tv_sec) >= 2) { /* * if delta_delta is too large, assume time correction * has occurred and set old_delta to the current delta. -- 1.9.1