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: 124812 Delivered-To: patch@linaro.org Received: by 10.46.62.1 with SMTP id l1csp77832lja; Wed, 17 Jan 2018 07:15:51 -0800 (PST) X-Google-Smtp-Source: ACJfBov1sDsa699LCM2YLR3kpZ1hiQs6r9Y+2GLAp6J24Ou8/hK35N642bkeF5bfHoO7f7QtBKvO X-Received: by 10.101.68.69 with SMTP id e5mr34745857pgq.413.1516202151117; Wed, 17 Jan 2018 07:15:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516202151; cv=none; d=google.com; s=arc-20160816; b=WPVAJ6dDhQsQkVMBz2+VVOG25nRGG0NKMyacmKaNXrCM4omCEzNoicPAuiYKee6Rjv DakBOzinaoOzNy01LgVGzjF5/SfsqwMWizfqJNvnYc9WO4pEFvPxQc8CZmK3YkBq68P6 utZVRyi488S/xFd46lIajH4jSV+BRfh7RCHuoBw3iekNq4oTE8v2SGftDNKg4b6ESh3c /xVP0tI8FXhlChI6qQ036RwXXgifh4ttNPJ6j5AfRM72DgQa0GUFzPt2ZYbPD7kI+TAk yo6oTH/8pkNc44OJ++9x++K0ZXpjBFHJwd5aRDiAXvkQACV+OrMWDjvZGCJH6Sf+n1lk +lxg== 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=mbZ6WU0xUl3rDyhPbVM82iBnpzpCq9CzkxhstPRn8xY=; b=hQ/AyfnW1v9FNQKd5DdGjB51gSBbKwiAMOdQNDRMFzWRv5GYaFRgWTJ1PuGtnz9s/X jx8TbQVrsACbFBFTeSvT5PYwuBEiI6Mi0D2P2yyq660pQrgPEGy77SXzctV/sOCMNRpd jtfcLsb9YdOMnlFGMl7cs68XVyC41xzkYCOqDS329G3IdRdbRUnFvMIEaW/Sk9msUmlc wZLT1filQT9qKIJvcjjl1+mHQ+PfbEwUx4ECGKd8FICjjqJwzZANyqlh7QdbFoUFVMzo 2O6Agzf3skCG6weGRWDdk5gArwgS3n0eENAySQDy0OI0guBzn4uBI8UU6+C0B48f687n qLhw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-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 d128si4591336pfg.108.2018.01.17.07.15.50; Wed, 17 Jan 2018 07:15:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-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-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753693AbeAQPPs (ORCPT + 1 other); 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 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(-) -- 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;