Received: by 10.223.164.202 with SMTP id h10csp263373wrb; Mon, 13 Nov 2017 06:09:36 -0800 (PST) X-Google-Smtp-Source: AGs4zMbtADmM1EmHdpA7oXRF+64BLEvDfhAigQY6xuN8tQQEX95x0CVlPype7E6cE8yT1g1QshM0 X-Received: by 10.99.53.3 with SMTP id c3mr8370257pga.194.1510582176437; Mon, 13 Nov 2017 06:09:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510582176; cv=none; d=google.com; s=arc-20160816; b=diPHvxgB44hcFwCvR9/l4XICMTXmZJUpOeGjTHswRGzfyb6e3slg14zjwoustLbQZp KiJv+FpIO3xlBggrEf/5YvpSwBrfd/y0O57linMAN1x8WrolW0pQfDLssPu8sNKU/K+o pJivUTcypzksPiS/V+GtPXhxpVpgpCppuCfe5hAjzw9HMnxkYxrBuPwCcWBiPnhjs7h6 QFWU8+3WIU8zOdJkvTBVj3z5pclQhj48++TUuvDBq3zSZNxxiDrK1G6NcQvG6P6mEgje SC+tA5MTTnmuJukFvlV3zEXAf9zWo5rU6F5kn3XK2gKlwWRSzZDGS0W2/YNcJkQXjU+F mljQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:date:cc:to:from:subject :message-id:arc-authentication-results; bh=X2fjXIxJrJt3067Ff0w4o0SRezjPKxJXsNLTIevX+P8=; b=JdHtNamX7vWV0GYW3/q2J8MTh21zfYNT1TVXUk2hKGH8Q2xt6a8ZvKA/iMlld8rCLs sKjTg03CiC5EDPiwzOArOtWvpWiyDXcp2FKOI7R8eAbnyLxl9zoibe7C6dKr75tdQvy0 CnW5iqRlrrNL8GHzFlwTg+ziP6VUmuhY0bNPwiYSEGh8wSadNv6z3+88IAv/h7Rwt4W0 0xNVUdTQgWhfiBqdYkBhEuAPc4SnSulExlxWi7iKolFfFUq1NseyE4JeJ/5EYrPPkyQu FhNcsoZOyO5yZkuoeCiB7LwpGdZ1SLHXcE1+MeL22OBr1kU5N/A65AQwHzqcQj/9QBQf V42Q== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=codethink.co.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v8si2163461pgt.466.2017.11.13.06.09.23; Mon, 13 Nov 2017 06:09:36 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=codethink.co.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752791AbdKMOIp (ORCPT + 93 others); Mon, 13 Nov 2017 09:08:45 -0500 Received: from imap1.codethink.co.uk ([176.9.8.82]:51812 "EHLO imap1.codethink.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751759AbdKMOIo (ORCPT ); Mon, 13 Nov 2017 09:08:44 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126] helo=xylophone) by imap1.codethink.co.uk with esmtpsa (Exim 4.84_2 #1 (Debian)) id 1eEFPh-0004WU-3C; Mon, 13 Nov 2017 14:08:37 +0000 Message-ID: <1510582114.18523.3.camel@codethink.co.uk> Subject: Re: [Y2038] [PATCH 3/7] scsi: bfa: improve bfa_ioc_send_enable/disable data From: Ben Hutchings To: Arnd Bergmann , Anil Gurumurthy , Sudarsana Kalluru , "James E . J . Bottomley" , "Martin K . Petersen" Cc: hare@suse.com, linux-scsi@vger.kernel.org, y2038@lists.linaro.org, linux-kernel@vger.kernel.org, jthumshirn@suse.de, hch@lst.de Date: Mon, 13 Nov 2017 14:08:34 +0000 In-Reply-To: <20171110153715.1929456-4-arnd@arndb.de> References: <20171110153715.1929456-1-arnd@arndb.de> <20171110153715.1929456-4-arnd@arndb.de> Organization: Codethink Ltd. Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6-1+deb9u1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2017-11-10 at 16:37 +0100, Arnd Bergmann wrote: > 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()); The byte order conversion should also logically be cpu_to_be32(), not be32_to_cpu(). Ben. >   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)); >  } >   -- Ben Hutchings Software Developer, Codethink Ltd. From 1583694038881830977@xxx Fri Nov 10 15:38:49 +0000 2017 X-GM-THRID: 1583694038881830977 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread