From patchwork Fri Oct 30 09:08:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tina Ruchandani X-Patchwork-Id: 7525611 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 87E9DBEEA4 for ; Fri, 30 Oct 2015 09:08:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9E7B92084B for ; Fri, 30 Oct 2015 09:08:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BD0252082A for ; Fri, 30 Oct 2015 09:08:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030303AbbJ3JIR (ORCPT ); Fri, 30 Oct 2015 05:08:17 -0400 Received: from mail-pa0-f51.google.com ([209.85.220.51]:34897 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758776AbbJ3JIP (ORCPT ); Fri, 30 Oct 2015 05:08:15 -0400 Received: by pasz6 with SMTP id z6so68888900pas.2 for ; Fri, 30 Oct 2015 02:08:15 -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=0TURjKFB3BwwxlX5oekuzTvJuxOjewuTNy+aQRvoZqg=; b=oAa71yZnmxfNrVMRSWgi1E3TzquX2NOFQQ+nQQD9YwnbHYAgXs29EwaYSZFNl2vyE3 y5nQ11O/sj8qst+Kwf5XOaxMBYElN6rkyV9UzYfqNMmyPq+LTfnAwUdaeiB1nbKQGzt4 xMG+GgCHD+mEZJ4z/a4NT6smqbNH1v/AgSwYR/itvwpzz8VX816hduDsHcQajofwyYmr vGfshF1rR1QAiBRqpGavj85O1Lh1TskFdKCAFycPfqdhh8beY9Hd4mjl3uQ9s9ol/gbv oeL5we1fPsBIRR6BdvqPR4IbXNySIVQjWFNcuagY5CM7qLkdlhQpQquEGXb6U4gY+z74 1Ypg== X-Received: by 10.66.228.199 with SMTP id sk7mr7670593pac.8.1446196095105; Fri, 30 Oct 2015 02:08:15 -0700 (PDT) Received: from tina-laptop ([2602:301:779f:31e0:dcc6:66f6:ae0d:2aff]) by smtp.gmail.com with ESMTPSA id bh1sm6913568pbc.26.2015.10.30.02.08.14 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 30 Oct 2015 02:08:14 -0700 (PDT) Date: Fri, 30 Oct 2015 02:08:03 -0700 From: Tina Ruchandani To: linux-scsi@vger.kernel.org Cc: Arnd Bergmann , "James E.J. Bottomley" , y2038@lists.linaro.org Subject: [RESEND PATCH] mpt3sas: Remove usage of 'struct timeval' Message-ID: <20151030090803.GA3679@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 timeval' will have its tv_sec value overflow on 32-bit systems in year 2038 and beyond. This patch replaces the use of struct timeval for computing mpi_request.TimeStamp, and instead uses ktime_t which provides 64-bit seconds value. The timestamp computed remains unaffected (milliseconds since Unix epoch). Signed-off-by: Tina Ruchandani --- drivers/scsi/mpt3sas/mpt3sas_base.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 1560115..ee9c3c6 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -56,6 +56,7 @@ #include #include #include +#include #include #include @@ -3735,7 +3736,7 @@ _base_send_ioc_init(struct MPT3SAS_ADAPTER *ioc, int sleep_flag) Mpi2IOCInitRequest_t mpi_request; Mpi2IOCInitReply_t mpi_reply; int i, r = 0; - struct timeval current_time; + ktime_t current_time; u16 ioc_status; u32 reply_post_free_array_sz = 0; Mpi2IOCInitRDPQArrayEntry *reply_post_free_array = NULL; @@ -3797,9 +3798,8 @@ _base_send_ioc_init(struct MPT3SAS_ADAPTER *ioc, int sleep_flag) /* This time stamp specifies number of milliseconds * since epoch ~ midnight January 1, 1970. */ - do_gettimeofday(¤t_time); - mpi_request.TimeStamp = cpu_to_le64((u64)current_time.tv_sec * 1000 + - (current_time.tv_usec / 1000)); + current_time = ktime_get_real(); + mpi_request.TimeStamp = cpu_to_le64(ktime_to_ms(current_time)); if (ioc->logging_level & MPT_DEBUG_INIT) { __le32 *mfp;