From patchwork Fri Oct 30 08:30:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tina Ruchandani X-Patchwork-Id: 7525411 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 F2D02BEEA4 for ; Fri, 30 Oct 2015 08:31:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2BC4820823 for ; Fri, 30 Oct 2015 08:31:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4258C2076F for ; Fri, 30 Oct 2015 08:31:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030442AbbJ3Iay (ORCPT ); Fri, 30 Oct 2015 04:30:54 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:34298 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030285AbbJ3Iaw (ORCPT ); Fri, 30 Oct 2015 04:30:52 -0400 Received: by padhk11 with SMTP id hk11so68041689pad.1; Fri, 30 Oct 2015 01:30:51 -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=E8XlgcFWP40rm3102/dx6A3nbgO0CRbFvhFDMABoWos=; b=Vb7LnGHMGdWDmwtL3XD+gQEZcHhZWxCRDP1UYdwlodUrUmedzgzvVQxtncRu/P7/gH TIBL+0pJdRbQIOcSqOMQI9GiwAMHnxbY29XQIuLZT6cvz98fwLV33nboCJFEEL6R8w0h CfvUj9blTDvf29gYMhngLbSo/yZaM8zOy7KPt7WA7752DJj3j1XOyINsya2jR1oR3cSA WmGDp3LT4CFfyZCsNCIglx6ppdJqMUtdddqC42Y8Dch/gU7VuzdtnJdKZ3z6879RzzzD txd9ReODN8ku5w5LuNy/8GXCDfizGegaRJqcMxcKZifzredB6TIUSeMphWYULr6vGtdN ITMA== X-Received: by 10.68.191.194 with SMTP id ha2mr7348584pbc.3.1446193851490; Fri, 30 Oct 2015 01:30:51 -0700 (PDT) Received: from tina-laptop ([2602:301:779f:31e0:dcc6:66f6:ae0d:2aff]) by smtp.gmail.com with ESMTPSA id xs2sm6627588pbb.75.2015.10.30.01.30.50 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 30 Oct 2015 01:30:51 -0700 (PDT) Date: Fri, 30 Oct 2015 01:30:40 -0700 From: Tina Ruchandani To: linux-scsi@vger.kernel.org, arnd@arndb.de Cc: "James E.J. Bottomley" , y2038@lists.linaro.org, linux-kernel@vger.kernel.org Subject: [RESEND PATCH v3] scsi: stex: Remove use of struct timeval Message-ID: <20151030083040.GA31741@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=unavailable 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 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 Reviewed-by: Johannes Thumshirn Reviewed-by: Arnd Bergmann --- 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);