From patchwork Fri Apr 20 16:02:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 133906 Delivered-To: patch@linaro.org Received: by 10.46.66.142 with SMTP id h14csp449341ljf; Fri, 20 Apr 2018 09:02:42 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/IcKu3QhFxIMrjINKxVjIJ6/6Uo7TbN8CF7pToyddh5EoPwpIyGgmrCkW26Lh6WZc+uU5G X-Received: by 10.99.167.4 with SMTP id d4mr1636296pgf.324.1524240162171; Fri, 20 Apr 2018 09:02:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524240162; cv=none; d=google.com; s=arc-20160816; b=AXxsGxShND1OTQ8MePyytniYd7f5saDwHu7vsRzTs8T5IijoePekfgXw0608yfmwNe oa79Zp1xFSHa/mmPFC2DuFSZcJpeKTEGUdeHHnnFeo7y/ArbDyyP1lhCx6JrwW8gFOCC v4wS19C1cDMqpzFmski22rA4M4TnZr7ygOgtY7N+bj+kZg6ZYskBvUHAIAt82djPc08F hVHkw9qpIFknbmxfwb/PbBO/vWbWtClWrvAlRPy3ZhTv46TdcJeTtFFdHfvjeJj4JiwR k5RnGD0JAV4MRkEmeg2UZo1QxnGTJt23viruFVF1RLEJK6xml3Lxmwq8SUg5zLlKYxpx wPdQ== 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=1HO1OjZfOTo/fcMcS97k9ivsyWB3D2ymUBLtz2xtkew=; b=o7h8BagNiMzhRSCOpfDMt56RmTteAFT+UWbgaZpuZ7JV/Eq0fc5Qku6NJXunXiL1cC e75XBDClGF4sWb4NL06wuKatLXYTdMERjUhkthd8PV5/huvtR5mec1Kyj2yANbe6IsZw YNAFaPOoDl6BNGbwpG7nMob68vJc5fMOg+kCt5SNicVW2mwPib0dg+e4GheK/fwQEy1W hOJaSnmcz8vZXHGfoqaYW6Il/BEI+zZKrimgG+0vzDA43lDEdP/HWC5TF9kU6Jz2X4bf TJ52lESvIGQlGL5sCs77vUskRSMALrk8dphgo4/h00a11tVIPlZMAOqMp5dwbB2LYKDX FBJg== 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 e29-v6si6006259plj.518.2018.04.20.09.02.40; Fri, 20 Apr 2018 09:02:42 -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 S1755968AbeDTQCh (ORCPT + 29 others); Fri, 20 Apr 2018 12:02:37 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:51115 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755923AbeDTQCf (ORCPT ); Fri, 20 Apr 2018 12:02:35 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0MUlX2-1evMdF0v2S-00YC9V; Fri, 20 Apr 2018 18:02:21 +0200 From: Arnd Bergmann To: Bradley Grove , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Christoph Hellwig , Tomas Henzl , Arnd Bergmann , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [RESEND 2] scsi: esas2r: use ktime_get_real_seconds() Date: Fri, 20 Apr 2018 18:02:09 +0200 Message-Id: <20180420160219.3560091-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K1:w3BU8myseDQpQSO/o/xq04Ipu0/0uvNIqfUWBZmDIeK14mlE2JU DyIAr08p4f/sO9SPUZu2GeQPYcRy2r12sWqol1R1dYqgB8suoOQ0jHo6rNTeUlmlXV6KEGC w1uLJvq/9yYN01kpU6YXvKx3jzdJi6iIvAbmRbXamyAsK7GZBQRnRYqs42QSZXsf5NHngIp awTCK0gtoV717JwEhxleA== X-UI-Out-Filterresults: notjunk:1; V01:K0:Uj+3k/qT1Go=:T5ztMrlipzpdfdf743xu24 AoKgmmSW6S4wh8vJoK7CvaDHIkrINDDPrkPSzp6NIZIWkAn20M6kplKDUqYK4/SITPcU6uwCL 4LTz5JPlmJNDv9mKrVuCtg1V8wOI0ZmUCAx9uTdykjrwJDRjBU9967lT9cIKmv3QeWtJxpHQg Huq/iIGIxlVcYt36JkhFEX+F3C5I+0es7ZyEa3IyLpsm1xlqCiUlyxMqWfTgZivDWm+TWqZks hrUjN/jCMjw1PJvh8gaVMq7VRX7MSpgpXjoeqSU1VXawV6gSiQig69AJCLfn3kjPbaYLoKsP9 dPBB4FT6X8n7IVK/JyZNv08qwW4B/cLFcPYSKZRJTHddDzuTMfxGkdDzmCyhP4m4QnFu0dyNp 32sZQAxmT3zDZeN7kmKuor/jHmi1sdo77GxJx3mwcUfTxg3lAtdIWpyz4iGUHaKtMtYhD8WME xuGhHGvVnBkG+sQgdIKx55rEBt1pV1Ak/Npy/1ss54fNnPIda8k75zm5jp/6W7ZH6pPdtmyir QPuJwRAz0h0JWog3ow8PnmtHP3jisdw0FG+TsPBy67lz5yPLXgJcbuC+KZK2Udig+eMzWWe2n z3hm/2lU6+VD3S/BCa9v12NbNGPcM9Mh+EiL3HUKyjJuGxG0965XTkvXRwVrydUZaQWyUyu8X 4dmogvOYvmiZEW3KzBDSqfCd+cr/VeKzdZTU+yL0K8c0WB7TY2yPGda0brsDBsx9kzoqkZxni ZePAxsm8ZjO4KGcoVsWcqfYh2ITh3MFt35eDwQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org do_gettimeofday() is deprecated because of the y2038 overflow. Here, we use the result to pass into a 32-bit field in the firmware, which still risks an overflow, but if the firmware is written to expect unsigned values, it can at least last until y2106, and there is not much we can do about it. This changes do_gettimeofday() to ktime_get_real_seconds(), which at least simplifies the code a bit, and avoids the deprecated interface. I'm adding a comment about the overflow to document what happens. Signed-off-by: Arnd Bergmann --- Originally submitted in November 2017, no reply. Sent again in January, still no reply. Resending once more now, could you please apply the trivial patch? --- drivers/scsi/esas2r/esas2r_init.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- 2.9.0 diff --git a/drivers/scsi/esas2r/esas2r_init.c b/drivers/scsi/esas2r/esas2r_init.c index 9dffcb28c9b7..9db645dde35e 100644 --- a/drivers/scsi/esas2r/esas2r_init.c +++ b/drivers/scsi/esas2r/esas2r_init.c @@ -1202,8 +1202,6 @@ static bool esas2r_format_init_msg(struct esas2r_adapter *a, case ESAS2R_INIT_MSG_START: case ESAS2R_INIT_MSG_REINIT: { - struct timeval now; - do_gettimeofday(&now); esas2r_hdebug("CFG init"); esas2r_build_cfg_req(a, rq, @@ -1212,7 +1210,8 @@ static bool esas2r_format_init_msg(struct esas2r_adapter *a, NULL); ci = (struct atto_vda_cfg_init *)&rq->vrq->cfg.data.init; ci->sgl_page_size = cpu_to_le32(sgl_page_size); - ci->epoch_time = cpu_to_le32(now.tv_sec); + /* firmware interface overflows in y2106 */ + ci->epoch_time = cpu_to_le32(ktime_get_real_seconds()); rq->flags |= RF_FAILURE_OK; a->init_msg = ESAS2R_INIT_MSG_INIT; break;