From patchwork Wed Jan 17 15:14:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10169453 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 00E0E603B5 for ; Wed, 17 Jan 2018 15:15:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4E3826E51 for ; Wed, 17 Jan 2018 15:15:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D756F27DCD; Wed, 17 Jan 2018 15:15:51 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 A66CD26E51 for ; Wed, 17 Jan 2018 15:15:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753693AbeAQPPs (ORCPT ); Wed, 17 Jan 2018 10:15:48 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:63715 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753657AbeAQPPn (ORCPT ); Wed, 17 Jan 2018 10:15:43 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue005 [212.227.15.129]) with ESMTPA (Nemesis) id 0MNyAB-1eUPpu2C8B-007YiK; Wed, 17 Jan 2018 16:15:09 +0100 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] scsi: esas2r: use ktime_get_real_seconds() Date: Wed, 17 Jan 2018 16:14:58 +0100 Message-Id: <20180117151508.3283064-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:6UoTfMMtqxRumE4LQk707sfN+pn/Z66j4GYJyUcIpJkjbOpT4PS v06AV3K9Zvhri9teicnDoaMn1HXOkK8vb5TAa7Y5CLrRukX1HrjkkfQL7tKOla03zR84qh7 apbj68lodNvjp16Osgy397iszQ69LGQKwGi6DEv3YoOM6dRYFfCUJXAme6gqzVbq3nEEKCl D9I4OJdexOw1UH4d1VtRw== X-UI-Out-Filterresults: notjunk:1; V01:K0:QIZBY7fOI2w=:V2tMWF/WmjK51cVA+mx6Mg ijKQIHu0gjjiJuolM7PXKuMQEe5JCpo4FFxzDgrk/Tk64k3IZJx4DnDpJ6D/Dsh0Lc4NClSMM lWMcETCsMtICn7e8sWNeujJGD9gPK8A8/lnUAheiDVqRXucH07HzvULJCd1BSov59Sg6CBB17 0g1x65quyk6+1iaUyPJXA7QSAge19PuElvxhp7HSo1npjllHO+TfLx40KSYt19iqsLaiKTvt8 b757kj+P4l6u5GpM0QiNVN62po8PsiOx8RuFRfU/J5lCn27X+TyMjgiGkcoEbjrqnLv5rHuwa EM0yZ6ismNBF91hamDqLxFQCDwsUmPG9eyIdNfHvLnXtsgByMVy6Pp2V5+MhIxdYzwI9Neu5t GzzdLM5TWI/s/RgIr3napJxMau+qxY8HON/QvYSH5cToYx6EJRAt1Tum7QGh0ST+zuqFXpxrh LCDELWHnu3q9Xn+0Rf9sw+oPvPgS8ZCSVRGaY5XRYfSStreXtrAmv6mQQFwrv949kKSAeNje9 bklo2nctze2S8lG62CFn0aYJvkIrrlyK1bahVFE4QGo2GDFXdHnxTVe1dHe0gM9oTf06PyOPF tQ87Jss3wFBKXtQ9TUlcDzZAe4a9tNPyWH21MKorgQThbLO2FvRHtD1H/NAQmRNFNqmvbF5SL YheOd5bV7YUfAiFayvmn5wOQuxlEZhi0iVzjJ6e+rjS7ZcH+kTM+AtQJAYO8TGjQunRtKaR3g gJ9aBKcdQDZc+iYaP1th11kqVH4pz0X//EQ7IA== Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 so I'm resending now, with Thomas and Christoph on Cc, as both have worked on this driver in the past. --- drivers/scsi/esas2r/esas2r_init.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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;