From patchwork Wed Aug 22 00:30:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10840 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 9399723E41 for ; Wed, 22 Aug 2012 00:31:04 +0000 (UTC) Received: from mail-gh0-f180.google.com (mail-gh0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id 51A52A188A1 for ; Wed, 22 Aug 2012 00:30:54 +0000 (UTC) Received: by ghbg10 with SMTP id g10so362047ghb.11 for ; Tue, 21 Aug 2012 17:31:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-content-scanned:x-cbid:x-gm-message-state; bh=TouTvTqa19Fx2zSj5paXDDVOQ8T/1C9bQwQ6Kmkxmq4=; b=N7UWqbYyHjB/GGmvGJR5JasZS+Kioztaz8v+5COdRWTsr7oEz6gzyyyqwJ5YjxPjq1 ZFuD94JOa6EtOUizUM3MzzkyQpDlwaSrYZM/v1iIG4H7Z+EhVtF9R+e8RZeO3O5Db0tp a58bdjldkdoc/Uh8XKzsqbfgppGVWjgQYMg2guaqDAEG4uOBJ16FiAtOuZLreZzT1XWZ gtMOYVF6BcIx+Wb4FGbPbZOs1jP4jMsqvmuIoyWgyG42cAqhSCa2nqrnaV7vbysSwasp WtN4kR8a6CMEqpMKG5mgB/yF+VmAq4KEQcswtSPOsjH/DjXjHujEUX4p45PI1VhVbNHJ AcyQ== Received: by 10.50.217.227 with SMTP id pb3mr351688igc.28.1345595463113; Tue, 21 Aug 2012 17:31:03 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp173735igc; Tue, 21 Aug 2012 17:31:02 -0700 (PDT) Received: by 10.50.36.195 with SMTP id s3mr296654igj.63.1345595461800; Tue, 21 Aug 2012 17:31:01 -0700 (PDT) Received: from e1.ny.us.ibm.com (e1.ny.us.ibm.com. [32.97.182.141]) by mx.google.com with ESMTPS id v4si4992026icx.44.2012.08.21.17.31.01 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 21 Aug 2012 17:31:01 -0700 (PDT) Received-SPF: neutral (google.com: 32.97.182.141 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=32.97.182.141; Authentication-Results: mx.google.com; spf=neutral (google.com: 32.97.182.141 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) smtp.mail=john.stultz@linaro.org Received: from /spool/local by e1.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 21 Aug 2012 20:31:00 -0400 Received: from d01dlp01.pok.ibm.com (9.56.250.166) by e1.ny.us.ibm.com (192.168.1.101) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 21 Aug 2012 20:30:58 -0400 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id 73F8838C803D; Tue, 21 Aug 2012 20:30:57 -0400 (EDT) Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q7M0UvBJ155748; Tue, 21 Aug 2012 20:30:57 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q7M0UvqI024424; Tue, 21 Aug 2012 21:30:57 -0300 Received: from kernel-pok.stglabs.ibm.com (kernel.stglabs.ibm.com [9.114.214.19]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q7M0UuAG024415; Tue, 21 Aug 2012 21:30:56 -0300 From: John Stultz To: linux-kernel Cc: Andreas Schwab , Ingo Molnar , Prarit Bhargava , Thomas Gleixner , John Stultz Subject: [PATCH 2/4] time: Fix casting issue in timekeeping_forward_now Date: Tue, 21 Aug 2012 20:30:47 -0400 Message-Id: <1345595449-34965-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1345595449-34965-1-git-send-email-john.stultz@linaro.org> References: <1345595449-34965-1-git-send-email-john.stultz@linaro.org> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12082200-6078-0000-0000-00000E83324C X-Gm-Message-State: ALoCoQkjVBEuNeLs3IBdZCqzf2XjDqMogDlayIFG5a3zgFkWmSM0TDpi3PTqtWH2A4Q1tdlzvods From: Andreas Schwab arch_gettimeoffset returns a u32 value which when shifted by tk->shift can overflow. Cast it to u64 first. This issue was introduced with 1e75fa8be9fb61e1af46b5b3b176347a4c958ca1 Cc: Ingo Molnar Cc: Prarit Bhargava Cc: Thomas Gleixner Signed-off-by: Andreas Schwab 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 258164a..1dbf80e 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -277,7 +277,7 @@ static void timekeeping_forward_now(struct timekeeper *tk) tk->xtime_nsec += cycle_delta * tk->mult; /* If arch requires, add in gettimeoffset() */ - tk->xtime_nsec += arch_gettimeoffset() << tk->shift; + tk->xtime_nsec += (u64)arch_gettimeoffset() << tk->shift; tk_normalize_xtime(tk);