From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030993AbbJ3L6h (ORCPT ); Fri, 30 Oct 2015 07:58:37 -0400 Received: from mx2.suse.de ([195.135.220.15]:55891 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030727AbbJ3L6g (ORCPT ); Fri, 30 Oct 2015 07:58:36 -0400 Subject: Re: [RESEND PATCH v3] scsi: stex: Remove use of struct timeval To: Tina Ruchandani , linux-scsi@vger.kernel.org, arnd@arndb.de References: <20151030083040.GA31741@tina-laptop> Cc: "James E.J. Bottomley" , y2038@lists.linaro.org, linux-kernel@vger.kernel.org From: Hannes Reinecke Message-ID: <56335B69.4010502@suse.de> Date: Fri, 30 Oct 2015 12:58:33 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20151030083040.GA31741@tina-laptop> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/30/2015 09:30 AM, Tina Ruchandani wrote: > Function stex_gettime uses 'struct timeval' whose tv_sec value > will overflow on 32-bit systems in year 2038 and beyond. This patch > replaces the use of struct timeval and do_gettimeofday with > ktime_get_real_seconds, which returns a 64-bit seconds value. > > Suggested-by: Arnd Bergmann > Signed-off-by: Tina Ruchandani > -- > Changes in v3: > - Remove stex_gettime altogether, directly assign the timestamp. > Changes in v2: > - Change subject line to indicate that the patch is restricted to stex driver. > --- > --- > drivers/scsi/stex.c | 13 +++---------- > 1 file changed, 3 insertions(+), 10 deletions(-) > > diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c > index 98a62bc..84e196e 100644 > --- a/drivers/scsi/stex.c > +++ b/drivers/scsi/stex.c > @@ -25,6 +25,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -362,14 +363,6 @@ MODULE_DESCRIPTION("Promise Technology SuperTrak EX Controllers"); > MODULE_LICENSE("GPL"); > MODULE_VERSION(ST_DRIVER_VERSION); > > -static void stex_gettime(__le64 *time) > -{ > - struct timeval tv; > - > - do_gettimeofday(&tv); > - *time = cpu_to_le64(tv.tv_sec); > -} > - > static struct status_msg *stex_get_status(struct st_hba *hba) > { > struct status_msg *status = hba->status_buffer + hba->status_tail; > @@ -1002,7 +995,7 @@ static int stex_common_handshake(struct st_hba *hba) > h->req_cnt = cpu_to_le16(hba->rq_count+1); > h->status_sz = cpu_to_le16(sizeof(struct status_msg)); > h->status_cnt = cpu_to_le16(hba->sts_count+1); > - stex_gettime(&h->hosttime); > + h->hosttime = cpu_to_le64(ktime_get_real_seconds()); > h->partner_type = HMU_PARTNER_TYPE; > if (hba->extra_offset) { > h->extra_offset = cpu_to_le32(hba->extra_offset); > @@ -1076,7 +1069,7 @@ static int stex_ss_handshake(struct st_hba *hba) > h->req_cnt = cpu_to_le16(hba->rq_count+1); > h->status_sz = cpu_to_le16(sizeof(struct status_msg)); > h->status_cnt = cpu_to_le16(hba->sts_count+1); > - stex_gettime(&h->hosttime); > + h->hosttime = cpu_to_le64(ktime_get_real_seconds()); > h->partner_type = HMU_PARTNER_TYPE; > h->extra_offset = h->extra_size = 0; > scratch_size = (hba->sts_count+1)*sizeof(u32); > Just remove 'hosttime' altogether. It serves no purpose whatsoever. Cheers, Hannes -- Dr. Hannes Reinecke zSeries & Storage hare@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)