From patchwork Fri Nov 10 15:39:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 118582 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp8081321qgn; Fri, 10 Nov 2017 07:40:07 -0800 (PST) X-Google-Smtp-Source: AGs4zMaBZVNMLydqUjWG/soBBMjKl/vOEykhV+5UFA/jmkS9J1XoVjwk8+8TQT2jw+dTPSFE+YwZ X-Received: by 10.159.207.134 with SMTP id z6mr751601plo.272.1510328407307; Fri, 10 Nov 2017 07:40:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510328407; cv=none; d=google.com; s=arc-20160816; b=v/MT1muxCqfoPlesXg9VDaRpOfNfCooyzljMhl8NKAUOI3T2M1eLthO/G/MvBJMvdh /jlOQx7+oISMmqW44KRdUwkEM0HweIYfv9QK4lO34V4HMDrZ/JS4Qo/o1yae60BClfI6 2CuDNs0EDhgSIbiO2BYLbPOfjNVAZe3wmA8M38UoRPTjf4CjpVs0SKuHvj1/veaZWHba feNaSYmCV5aTtjzNehwcoxe2Un1NWBtYPClOvBIccZCwzidLnl8rDqVB7iJ44K5uyu89 bkkS7irPMFVmoAbHsqY02QjeDu+rjEQJ4Vn37VWJzSmKp5SrWFZQs38E+PbZ7wWrt03E SI9g== 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=r9hf/teuZbqEDgx9ILJvJvzT4i6P3y+0giZxpubT5Bc=; b=r3knKs5G5hT4f5fKBYVJmlbjqlte1YGUh0JwYa/Qg0/zy1I8+SKtYbZdJ67IptjooV f8RrgG+IjfH9d/IteXxmcYLjDjs3vdv+P41Dy9ac3TM6u4qw1VlwOT967sPyWvk8lVWD G+A7LhHDBZfENarFM5pMjObNU20H0EAbFec+lVj/4vPFgBGoffe5QzN0QZbUQcpcsFW8 ED8x9BkpaPEUIlZvWFo57/s2FNCvo17pS8dxj2AN4ob+SjVMjpyzfEP3m0TYWf1vOswU I38m24T7PypY3ZY5LV9ZOpqRfd3xI3Z2coohfIVXh69xrf9Jx/SQCe3qys3we/Yu7HrL HhXw== 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 h123si8780445pgc.605.2017.11.10.07.40.07; Fri, 10 Nov 2017 07:40:07 -0800 (PST) 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 S1752788AbdKJPkF (ORCPT + 23 others); Fri, 10 Nov 2017 10:40:05 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:59072 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751133AbdKJPkD (ORCPT ); Fri, 10 Nov 2017 10:40:03 -0500 Received: from wuerfel.lan ([109.193.157.232]) by mrelayeu.kundenserver.de (mreue007 [212.227.15.129]) with ESMTPA (Nemesis) id 0LgBIO-1eyOno3QtI-00nkWU; Fri, 10 Nov 2017 16:39:48 +0100 From: Arnd Bergmann To: Bradley Grove , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Arnd Bergmann , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: esas2r: use ktime_get_real_seconds() Date: Fri, 10 Nov 2017 16:39:34 +0100 Message-Id: <20171110153947.1932747-1-arnd@arndb.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FJBQUA== 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 --- 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 5b14dd29b764..67b3e3354e3c 100644 --- a/drivers/scsi/esas2r/esas2r_init.c +++ b/drivers/scsi/esas2r/esas2r_init.c @@ -1223,8 +1223,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, @@ -1233,7 +1231,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;