All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tina Ruchandani <ruchandani.tina@gmail.com>
To: linux-scsi@vger.kernel.org
Cc: Arnd Bergmann <arnd@arndb.de>,
	"James E.J. Bottomley" <JBottomley@parallels.com>
Subject: [PATCH] scsi: Remove use of struct timeval
Date: Wed, 4 Feb 2015 08:34:48 +0530	[thread overview]
Message-ID: <20150204030448.GA3666@tinar> (raw)

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.

Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
---
 drivers/scsi/stex.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 98a62bc..40b6290 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -25,6 +25,7 @@
 #include <linux/types.h>
 #include <linux/module.h>
 #include <linux/spinlock.h>
+#include <linux/ktime.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/byteorder.h>
@@ -364,10 +365,7 @@ MODULE_VERSION(ST_DRIVER_VERSION);
 
 static void stex_gettime(__le64 *time)
 {
-	struct timeval tv;
-
-	do_gettimeofday(&tv);
-	*time = cpu_to_le64(tv.tv_sec);
+	*time = cpu_to_le64(ktime_get_real_seconds());
 }
 
 static struct status_msg *stex_get_status(struct st_hba *hba)
-- 
2.2.0.rc0.207.ga3a616c


             reply	other threads:[~2015-02-04  3:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-04  3:04 Tina Ruchandani [this message]
2015-02-04 15:01 ` [PATCH] scsi: Remove use of struct timeval Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150204030448.GA3666@tinar \
    --to=ruchandani.tina@gmail.com \
    --cc=JBottomley@parallels.com \
    --cc=arnd@arndb.de \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.