From patchwork Tue Sep 15 01:05:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 53608 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by patches.linaro.org (Postfix) with ESMTPS id 769EF22B17 for ; Tue, 15 Sep 2015 01:05:39 +0000 (UTC) Received: by wicgb1 with SMTP id gb1sf1800405wic.3 for ; Mon, 14 Sep 2015 18:05:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=gTNQBYR8QWKi1Lmft4YlQGouNuwm2N3gCAG+ve2J1sk=; b=Wan/iXbuAOk0QvQa1OCDEDS1pt1a5Z4cIS8z7dZ8yFlNr0UiLpTFrm8d8H5ATnMQB5 Z6aEGFrRCYreWz8FqFTXtYGo56uujB6wj/phbNWQ/PCdL0fBaM1IJ9N6njzbPkLoLB1h ys0X7NFwxoEOUpSb3OYgKiF4buU48+6EZZmDPYp/b7zW9NOVtdUrllTv22NV4sox/lcC 7jeslFtbIIPbXmehgOctxDVaPb3FXmfgBbyiE5nGPTXzxxBsfkPPzYIu4h5pbYrOsWlZ JG6RatBrBvyuHQojIOd5yX5FbQdDfLVtQBDe8NBVJvCLOcXfS6tgIMeEzuK5cBsJayU2 DUEQ== X-Gm-Message-State: ALoCoQlcjVrFXWSxNVKKBSxygez7dYMEULRJlzyNXNg6oPtnGQtSCbyFFvpEdMqjKcuMulHGbbSY X-Received: by 10.112.57.194 with SMTP id k2mr3664755lbq.10.1442279138780; Mon, 14 Sep 2015 18:05:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.232 with SMTP id p8ls162091laf.85.gmail; Mon, 14 Sep 2015 18:05:38 -0700 (PDT) X-Received: by 10.112.158.38 with SMTP id wr6mr17591401lbb.25.1442279138626; Mon, 14 Sep 2015 18:05:38 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id rd4si11512429lac.177.2015.09.14.18.05.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Sep 2015 18:05:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by lamp12 with SMTP id p12so96300270lam.0 for ; Mon, 14 Sep 2015 18:05:38 -0700 (PDT) X-Received: by 10.112.199.70 with SMTP id ji6mr17534995lbc.73.1442279138118; Mon, 14 Sep 2015 18:05:38 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1489192lbq; Mon, 14 Sep 2015 18:05:37 -0700 (PDT) X-Received: by 10.50.50.240 with SMTP id f16mr1107695igo.95.1442279135270; Mon, 14 Sep 2015 18:05:35 -0700 (PDT) Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com. [209.85.220.52]) by mx.google.com with ESMTPS id zp7si27245205pac.216.2015.09.14.18.05.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Sep 2015 18:05:35 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.52 as permitted sender) client-ip=209.85.220.52; Received: by padhk3 with SMTP id hk3so158737016pad.3 for ; Mon, 14 Sep 2015 18:05:34 -0700 (PDT) X-Received: by 10.66.65.234 with SMTP id a10mr41058616pat.2.1442279134338; Mon, 14 Sep 2015 18:05:34 -0700 (PDT) Received: from localhost.localdomain (c-76-115-103-22.hsd1.or.comcast.net. [76.115.103.22]) by smtp.gmail.com with ESMTPSA id td5sm18441531pbc.67.2015.09.14.18.05.33 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 Sep 2015 18:05:33 -0700 (PDT) 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> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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.