Skip to contentSkip to conversation

scsi: Remove use of struct timeval

PATCH In review Tina Ruchandani 2 participants 2 messages Feb 4, 2015 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: Remove use of struct timeval

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.

---
 drivers/scsi/stex.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/scsi/stex.c +2 -4
index 98a62bc..40b6290 100644
@@ -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)
Signature · 1 line
2.2.0.rc0.207.ga3a616c
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · On Wednesday 04 February 2015 08:34:48 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.

The patch looks good, but please send it again with a proper subject that mentions the name of the driver.

Arnd