From patchwork Thu Nov 2 11:42:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10038575 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 34EF1603B5 for ; Thu, 2 Nov 2017 11:42:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2783F28ED4 for ; Thu, 2 Nov 2017 11:42:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B84028EE0; Thu, 2 Nov 2017 11:42:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 884E928ED4 for ; Thu, 2 Nov 2017 11:42:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752347AbdKBLmP (ORCPT ); Thu, 2 Nov 2017 07:42:15 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:64344 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751401AbdKBLmO (ORCPT ); Thu, 2 Nov 2017 07:42:14 -0400 Received: from wuerfel.lan ([109.193.157.232]) by mrelayeu.kundenserver.de (mreue005 [212.227.15.129]) with ESMTPA (Nemesis) id 0Le9EG-1dMv2k1P5g-00pwR7; Thu, 02 Nov 2017 12:42:10 +0100 From: Arnd Bergmann To: Bart Van Assche Cc: Arnd Bergmann , Jens Axboe , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] skd: use ktime_get_real_seconds() Date: Thu, 2 Nov 2017 12:42:00 +0100 Message-Id: <20171102114209.1686507-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:POcQN4ivKgV+081WEJa+znuQwNZyMzNF0tVJS2hiydtFGFEu/OX O1wQ6H17hmG5i+UJchdmFJAnPP7hapHcU6GPz8UYSUWZWcMPDS1VbNldHQ7d23dUTdDnYW6 e++l2PlJxACzS9T1HUHz8dpBEtLulSNKHWB6JZPLhtBzFV9ihOSj/h9DGjORWfjxXJIweds EdQu+V/VJob1h58oh63XA== X-UI-Out-Filterresults: notjunk:1; V01:K0:azF1wTTR1Zc=:pkgVSWuVX/L9lbfxVqpWLO p6GQeGUXRqnNZ3nTlX3a+kWS4usdd7+M0CD4d0yOaX7NOywI1EMSbidSx96Y4wopUHjKLeJqY FyxeeLPSFofHmidISmA0WMqgahLkdmypA66G+JVqyHuGjy9ek3KJztGkKS51RJNlbtWxcuE7z uy4jBbuyvLy+J08csqTfpyfktVvUWiBS73XNfkOcLsBJdLW/yIR3bxhjvliCU8Ddj1KJS3nlT Exs7CSekVIwLh176Q4QVY6sCICg8h1U2J2o/f+816SL127TgwYEUt3ShRczqKTFEp9VPOZWCN MRg8BBfVaRhEpWEShwAMpgYuARyFXhldAhcH2J0NewYCVW5cwm7e/yBZ5IMjzAZ39RXRTIHtT dSTEt/OLwRQhWhn8rPTLcksTu5VzSR8rI9IzTmX3+4NWwJTr5J1n15jsi/F0lcy6TYonvlh7N jEWJ64bPrruTIgeMB+nHLdx44XYblrgGBKNC8Tjwc7nhBh33UIGx6y//1GoKwGLMUweovUWa+ Re32RJz6ex88Zx055W3DjRFxXUcg0F56YUh8PMcbs/BaA/SeNrh5T8k6rxjGnCa2ZylYBJyt6 QFnZPsSa3Ueq8rLzs5XG/rkete7zA3RgoSNhqUMXd9DhOPQF/8z0mDYmKmmslyH0Zj2bbeVI+ 3EFsxmo7AdOS694NEfFoAxvngalqn8F0tIVunwU1Rw89GBeDPCSB9vxoVTOLcIRM2/lAL8Gmt HK06+lbAfh1BUYWyzA4Uj83T2AXQvmE671qPgQ== Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Like many storage drivers, skd uses an unsigned 32-bit number for interchanging the current time with the firmware. This will overflow in y2106 and is otherwise safe. However, the get_seconds() function is generally considered deprecated since the behavior is different between 32-bit and 64-bit architectures, and using it may indicate a bigger problem. To annotate that we've thought about this, let's add a comment here and migrate to the ktime_get_real_seconds() function that consistently returns a 64-bit number. Signed-off-by: Arnd Bergmann --- drivers/block/skd_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c index 64d0fc17c174..2819f23e8bf2 100644 --- a/drivers/block/skd_main.c +++ b/drivers/block/skd_main.c @@ -1967,7 +1967,8 @@ static void skd_isr_msg_from_dev(struct skd_device *skdev) break; case FIT_MTD_CMD_LOG_HOST_ID: - skdev->connect_time_stamp = get_seconds(); + /* hardware interface overflows in y2106 */ + skdev->connect_time_stamp = (u32)ktime_get_real_seconds(); data = skdev->connect_time_stamp & 0xFFFF; mtd = FIT_MXD_CONS(FIT_MTD_CMD_LOG_TIME_STAMP_LO, 0, data); SKD_WRITEL(skdev, mtd, FIT_MSG_TO_DEVICE);