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: 117801 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2053349qgn; Thu, 2 Nov 2017 04:42:19 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RUYofP5/ISYZCbj/3T9/0tdaOOSm4nw49PhqmGkymWBp18MrIJ3O1KALa8Kty5UPltPsPZ X-Received: by 10.99.105.72 with SMTP id e69mr3260661pgc.50.1509622939637; Thu, 02 Nov 2017 04:42:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509622939; cv=none; d=google.com; s=arc-20160816; b=ozCKFm1AsAMiwhLcSg7yjExvjVJxHJ631Y+Nk/8ErPZIUDhS16uX4w5WIZ72ptr7Rp ozFDySxH7Q0gDux6rxeHJOh0OtNd+lklPYS9uM8rpIsarD9appqih81cuFzQE0rs1FTN 1jRTQLDbH6NpboSCPUWJbFp92X+r6c3q0XM56zFMHTzwC+urVWxEZMgXHzrTrGSuEjKV UPrTXoCazCA7WCP+DOgZoT27xebm7mbUV0rjl/8pAs3OvTw69OcM6XhdIdK1vV2IXAoV vfYSshfHgb41HwSUUam/5wwEuWgA8s093I2AleyUcqOFQW30U+2OkdDgngtJFZ9F/R6e vvpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=j1W16XIQDTCdow31ws1katTfjUurx3CQvAPB27k6fSc=; b=XjD4tIz2CZSvcWilZxKFAPbeWuE+IfDcn4XdcO2xsaEHmbDxoeYsedDFPsxBGY95mz P6XKFakjkUInLnLxhRl9K3gJxoPcWyF9NUCu2XhsWteLlWQapJDfjLRao94iM9DPAwew ukeb8KnPhTcwuiw4B/E9++jVmrfGBP8mI480zH+09eq4DXUf3JCXGUwoGuX7WPTcJyWU KWLM1TT1jljZLoFyDr/MDkmvuQdz4aHajoq5ZIzyHQRd+v+pvA5bN7mAOM/ZX8vcGVwY 7Qe+j2wPt5a6nxfUD9wNHOq5ELgjhjwT9I5dPW7AU7ZkbfBS1qka2bh/9uU6f4UduQz1 uFnw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j25si3365450pgn.86.2017.11.02.04.42.19; Thu, 02 Nov 2017 04:42:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932576AbdKBLmQ (ORCPT + 26 others); Thu, 2 Nov 2017 07:42:16 -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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.9.0 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);