From patchwork Fri Nov 10 15:37:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10053357 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 6125A60631 for ; Fri, 10 Nov 2017 15:38:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 513352B372 for ; Fri, 10 Nov 2017 15:38:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 45AE62B376; Fri, 10 Nov 2017 15:38:12 +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=unavailable 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 0309A2B372 for ; Fri, 10 Nov 2017 15:38:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753295AbdKJPhv (ORCPT ); Fri, 10 Nov 2017 10:37:51 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:57844 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753211AbdKJPhs (ORCPT ); Fri, 10 Nov 2017 10:37:48 -0500 Received: from wuerfel.lan ([109.193.157.232]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.145]) with ESMTPA (Nemesis) id 0Md4Bm-1eVGDm194k-00IC6o; Fri, 10 Nov 2017 16:37:32 +0100 From: Arnd Bergmann To: Anil Gurumurthy , Sudarsana Kalluru , "James E . J . Bottomley" , "Martin K . Petersen" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, y2038@lists.linaro.org, hch@lst.de, hare@suse.com, jthumshirn@suse.de, Arnd Bergmann Subject: [PATCH 3/7] scsi: bfa: improve bfa_ioc_send_enable/disable data Date: Fri, 10 Nov 2017 16:37:11 +0100 Message-Id: <20171110153715.1929456-4-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20171110153715.1929456-1-arnd@arndb.de> References: <20171110153715.1929456-1-arnd@arndb.de> X-Provags-ID: V03:K0:swalmTZADPr80V+qrfarea+osqfK3nMzF4+jTsQlJ75WWB6Butx qUXjFc9vqGfUTBlQWWSOl/2PKDBHh2R100ArGopGw3BXH83Owp7cAYycppbbzJ22r7tIQ17 CwrGfaD0iLgeQkpKr/n3S1aK8uWhypS54l8qtKoGlF6OAm52tp4gwZxXhvctNPiG683slei AqnnENhEsIwXX8A6cTpLw== X-UI-Out-Filterresults: notjunk:1; V01:K0:lQB3U3k6tu8=:AEyMp8zztygPfQiRCrQqSp qmfeGiTtjNbePo1RLdHUe0mgiw8xXiTwP5PJg/EpuXOhir8cBIUcJWrltKy4m33M2gRbnG9Qa cZIdaGdLyflNEuiz1Ab9tzFdtMgaCj1G+f1H+XVaFO7r3esEQ+2RNRqltQCfK2jjlnSH63oBq 4kzrzqnjnw3PZMc7n+pXZQZcFOjpedxx4ZCPLHROzmiqQb4AUSQLX7c64H+BPiXMqFp3f2D7f yoOEw4LEwve2dcVPJoKKWKnGBUSucvfH4GKcdLCZ6Ml9mQnomIXCb+VVU7kJiiUX7/JgCFOEd KMXF7LFK90p3DjutDmTeWNbn5vr4PC1nf4keRrKK0nRjbGowQ/6h8dlPulFX7CtZbf8oPszh/ q8qw0ejXZnTYRVFHOUzsyU5ixY4EiE5jRCtK8po5o5eubwWvM2cyYKk5drT7jDZhPVjd7GA69 5/98lgXOaQ0n4Hz5UjfBxG2oM7w5ctH0hvQv/MRV4zlJxa09QJ6cdeTS+bHbsuE8H7nwyku1j Qmks4i9dQYhEfwc0Nb6mCkrGq7qnsRJgmdybN0BFLxblXdY/yMQVbLGnCXIS7Cv2zVNG8BefB ixxYHBoZW0kK6w8bvKBK6CJfrQpPPIz8Oani9LNtvKTIDW6UXw4C/3uGwdYc5nNi4xE/9fy05 seFhWGk/1XcYOP55qfHtIik7r8i1WISeg79W4Ni7AnKjapFTk1kq4DRzT8kvEM6GkBHImciEo 7OMXMdYTy9GQFmYwIt0DMCVOv5J9+OP/1Ec7IQ== 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 In bfa_ioc_send_enable, we use the deprecated do_gettimeofday() function to read the current time. This is not a problem, since the firmware interface is already limited to 32-bit timestamps, but it's better to use ktime_get_seconds() and document what the limitation is. I noticed that I did the same change in commit a5af83925363 ("bna: avoid writing uninitialized data into hw registers") for the ethernet driver. That commit also changed the "disable" funtion to initialize the data we pass to the firmware properly, so I'm doing the same thing here. Signed-off-by: Arnd Bergmann --- drivers/scsi/bfa/bfa_ioc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/bfa/bfa_ioc.c b/drivers/scsi/bfa/bfa_ioc.c index 256f4afaccf9..117332537763 100644 --- a/drivers/scsi/bfa/bfa_ioc.c +++ b/drivers/scsi/bfa/bfa_ioc.c @@ -1809,13 +1809,12 @@ static void bfa_ioc_send_enable(struct bfa_ioc_s *ioc) { struct bfi_ioc_ctrl_req_s enable_req; - struct timeval tv; bfi_h2i_set(enable_req.mh, BFI_MC_IOC, BFI_IOC_H2I_ENABLE_REQ, bfa_ioc_portid(ioc)); enable_req.clscode = cpu_to_be16(ioc->clscode); - do_gettimeofday(&tv); - enable_req.tv_sec = be32_to_cpu(tv.tv_sec); + /* unsigned 32-bit time_t overflow in y2106 */ + enable_req.tv_sec = be32_to_cpu(ktime_get_real_seconds()); bfa_ioc_mbox_send(ioc, &enable_req, sizeof(struct bfi_ioc_ctrl_req_s)); } @@ -1826,6 +1825,9 @@ bfa_ioc_send_disable(struct bfa_ioc_s *ioc) bfi_h2i_set(disable_req.mh, BFI_MC_IOC, BFI_IOC_H2I_DISABLE_REQ, bfa_ioc_portid(ioc)); + disable_req.clscode = cpu_to_be16(ioc->clscode); + /* unsigned 32-bit time_t overflow in y2106 */ + disable_req.tv_sec = be32_to_cpu(ktime_get_real_seconds()); bfa_ioc_mbox_send(ioc, &disable_req, sizeof(struct bfi_ioc_ctrl_req_s)); }