Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2165868pxb; Mon, 11 Jan 2021 02:43:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJwb8z21rWOk2JrgQQS8d+AMd/l0imbGpmDZpWDgPNlFziqqh36hVYZLVGUr1+oXvalYqxFy X-Received: by 2002:a17:906:d9c7:: with SMTP id qk7mr10412844ejb.384.1610361805429; Mon, 11 Jan 2021 02:43:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610361805; cv=none; d=google.com; s=arc-20160816; b=g8XqMzvI+GtJdu0/iswwrML+x6sWESNyTCpj/HNXOsyV+gd9gELotjSGoYO6wxgxbg /545OC+3i/nynROwGVM341L15Z1p/TErq3jZK2uc+PeRpiXtIWq7JXG9vhHj9MbfVnOe 8WltosNRWmHZu7FUbAtCERXOx3QgkHwFu5dXU2SHuMsXvLj86edJ8gRH45dGh6EyhxeP 0+pdcImIHuBn9JF0PxTcbspv25Ky2TCPAkt9fjifh2967VaRdA3WsHySaq7rpc1/YX/6 Zj3seDjhPGCA+5bY3p79KeEQ8K1v3c4fT+cNBatmK7692YYAC/W6fKzPpydjeTWMUjog eEeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Sr9cK4oRBj4b5jYUhsfENFBODaIBbEaaMDpEnxoj/iI=; b=Dm2qXCa1g8GG6/C4wI6jYgsnbFoCSYh/B6XDnzrq/mFcF77kJKP/dfIvEnv3I3CN6Q Z0sUWugYHk6GLx56gaJ86ET4qRNq1Ya+xIL4qQQTgbpcJ2u2lxwjjqo73IevT22BSqHR 6eQP+fAZMbIdKJjGjleh1IR8nl3KHP5EqZtz92krg0vFIDhZMBcOS/aovKDa0nRfOpyi klq1C8wpMYUZjl3fiE+dv3BpZW9VnpPHdA+/ttmkXz/CBqrnzL3YFhZIswMG1zisEuYc 0BAoSkxzvZDohQzVerRPinMCUZvLJ0ZLg2F1meG2FfkRCEuilZjUn5Y1SxNpyJucEMcr N/pw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p22si5712892edt.391.2021.01.11.02.43.02; Mon, 11 Jan 2021 02:43:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729245AbhAKKkl (ORCPT + 99 others); Mon, 11 Jan 2021 05:40:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728941AbhAKKkl (ORCPT ); Mon, 11 Jan 2021 05:40:41 -0500 Received: from michel.telenet-ops.be (michel.telenet-ops.be [IPv6:2a02:1800:110:4::f00:18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7374C061786 for ; Mon, 11 Jan 2021 02:40:00 -0800 (PST) Received: from ramsan.of.borg ([84.195.186.194]) by michel.telenet-ops.be with bizsmtp id FNfy2400e4C55Sk06NfyTn; Mon, 11 Jan 2021 11:39:58 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1kyucA-002o7L-08; Mon, 11 Jan 2021 11:39:58 +0100 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1kyuc9-001DYH-DI; Mon, 11 Jan 2021 11:39:57 +0100 From: Geert Uytterhoeven To: John Stultz , Thomas Gleixner , Jason Gunthorpe , Alexandre Belloni Cc: Stephen Boyd , linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] ntp: Fix RTC synchronization on 32-bit platforms Date: Mon, 11 Jan 2021 11:39:56 +0100 Message-Id: <20210111103956.290378-1-geert+renesas@glider.be> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Due to an integer overflow, RTC synchronization now happens every 2s instead of the intended 11 minutes. Fix this by forcing 64-bit arithmetic for the sync period calculation. Fixes: c9e6189fb03123a7 ("ntp: Make the RTC synchronization more reliable") Signed-off-by: Geert Uytterhoeven --- kernel/time/ntp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 7404d38315276a96..54d52fab201d283e 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c @@ -498,7 +498,7 @@ int second_overflow(time64_t secs) static void sync_hw_clock(struct work_struct *work); static DECLARE_WORK(sync_work, sync_hw_clock); static struct hrtimer sync_hrtimer; -#define SYNC_PERIOD_NS (11UL * 60 * NSEC_PER_SEC) +#define SYNC_PERIOD_NS (11ULL * 60 * NSEC_PER_SEC) static enum hrtimer_restart sync_timer_callback(struct hrtimer *timer) { -- 2.25.1