From patchwork Fri Oct 30 09:11:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tina Ruchandani X-Patchwork-Id: 7525621 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 443F2BEEA4 for ; Fri, 30 Oct 2015 09:11:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 698742082A for ; Fri, 30 Oct 2015 09:11:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7CA42207B8 for ; Fri, 30 Oct 2015 09:11:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758892AbbJ3JLY (ORCPT ); Fri, 30 Oct 2015 05:11:24 -0400 Received: from mail-pa0-f51.google.com ([209.85.220.51]:36520 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758631AbbJ3JLV (ORCPT ); Fri, 30 Oct 2015 05:11:21 -0400 Received: by pacfv9 with SMTP id fv9so71832531pac.3 for ; Fri, 30 Oct 2015 02:11:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=Ia06oo0c4j7+P/zYQhCKiv30+1DZCMYGn8AbBZE5yCY=; b=W2EHMW97yLo2+YyVubxs2uxPzLYad7KCiAY5xfiX7l9kmQMrWLzmHaUD65DL7q5/Pr gHMxSY4JCBMvYSSV2MK/7CH12JHUNFjAFe0aM0FYi48cb0Z3FoUx6c2GN5/QqyBN26oM Vbt2BRcDRwS//y4/w6LTuyD6I7k7izAg7x/Dpcfr+qHHQ2orpr5acCcn0DkT9qeKII6Y QtjVgXSRZyJJbYgO+RR2c2MA/6YISoxEFgSu84C5k6Ge3NTsX6DE67wSxWlejwIAyGBv VEvOVTNDR0k8QWXBo/4lH0fAgkntl7ZJga4E/ilpAbD2xTi6rivs684S37MovvCOOJPi 4H5w== X-Received: by 10.66.129.137 with SMTP id nw9mr7385392pab.107.1446196281369; Fri, 30 Oct 2015 02:11:21 -0700 (PDT) Received: from tina-laptop ([2602:301:779f:31e0:dcc6:66f6:ae0d:2aff]) by smtp.gmail.com with ESMTPSA id ju7sm6904066pbc.46.2015.10.30.02.11.20 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 30 Oct 2015 02:11:21 -0700 (PDT) Date: Fri, 30 Oct 2015 02:11:10 -0700 From: Tina Ruchandani To: linux-scsi@vger.kernel.org Cc: Arnd Bergmann , "James E.J. Bottomley" , y2038@lists.linaro.org Subject: [RESEND PATCH] [SCSI] mvumi: 64bit value for seconds_since1970 Message-ID: <20151030091110.GA3880@tina-laptop> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP struct mvumi_hs_page2 stores a "seconds_since1970" field which is of type u64. It is however, written to, using 'struct timeval' which has a 32-bit seconds field and whose value will overflow in year 2038. This patch uses ktime_get_real_seconds() instead since it provides a 64-bit seconds value, which is 2038 safe. Signed-off-by: Tina Ruchandani Reviewed-by: Johannes Thumshirn Reviewed-by: Arnd Bergmann --- drivers/scsi/mvumi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c index 3e6b866..02360de 100644 --- a/drivers/scsi/mvumi.c +++ b/drivers/scsi/mvumi.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -858,8 +859,8 @@ static void mvumi_hs_build_page(struct mvumi_hba *mhba, struct mvumi_hs_page2 *hs_page2; struct mvumi_hs_page4 *hs_page4; struct mvumi_hs_page3 *hs_page3; - struct timeval time; - unsigned int local_time; + u64 time; + u64 local_time; switch (hs_header->page_code) { case HS_PAGE_HOST_INFO: @@ -877,9 +878,8 @@ static void mvumi_hs_build_page(struct mvumi_hba *mhba, hs_page2->slot_number = 0; hs_page2->intr_level = 0; hs_page2->intr_vector = 0; - do_gettimeofday(&time); - local_time = (unsigned int) (time.tv_sec - - (sys_tz.tz_minuteswest * 60)); + time = ktime_get_real_seconds(); + local_time = (time - (sys_tz.tz_minuteswest * 60)); hs_page2->seconds_since1970 = local_time; hs_header->checksum = mvumi_calculate_checksum(hs_header, hs_header->frame_length);