diff options
author | Tina Ruchandani <ruchandani.tina@gmail.com> | 2015-10-30 04:30:40 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Odin.com> | 2015-11-09 20:42:19 -0500 |
commit | 0da39687a15403251bdfd1c6fb18025c0607326b (patch) | |
tree | 624cc14dc0979e97981332ae81c1b5725b2908b2 | |
parent | 5cb9b40d6127fed91b00abe44498f19f6ed6a77f (diff) |
stex: 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.
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
-rw-r--r-- | drivers/scsi/stex.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c index 56353cd9abd3..2de28d7a0b04 100644 --- a/drivers/scsi/stex.c +++ b/drivers/scsi/stex.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
28 | #include <linux/ktime.h> | ||
28 | #include <asm/io.h> | 29 | #include <asm/io.h> |
29 | #include <asm/irq.h> | 30 | #include <asm/irq.h> |
30 | #include <asm/byteorder.h> | 31 | #include <asm/byteorder.h> |
@@ -362,14 +363,6 @@ MODULE_DESCRIPTION("Promise Technology SuperTrak EX Controllers"); | |||
362 | MODULE_LICENSE("GPL"); | 363 | MODULE_LICENSE("GPL"); |
363 | MODULE_VERSION(ST_DRIVER_VERSION); | 364 | MODULE_VERSION(ST_DRIVER_VERSION); |
364 | 365 | ||
365 | static void stex_gettime(__le64 *time) | ||
366 | { | ||
367 | struct timeval tv; | ||
368 | |||
369 | do_gettimeofday(&tv); | ||
370 | *time = cpu_to_le64(tv.tv_sec); | ||
371 | } | ||
372 | |||
373 | static struct status_msg *stex_get_status(struct st_hba *hba) | 366 | static struct status_msg *stex_get_status(struct st_hba *hba) |
374 | { | 367 | { |
375 | struct status_msg *status = hba->status_buffer + hba->status_tail; | 368 | struct status_msg *status = hba->status_buffer + hba->status_tail; |
@@ -1002,7 +995,7 @@ static int stex_common_handshake(struct st_hba *hba) | |||
1002 | h->req_cnt = cpu_to_le16(hba->rq_count+1); | 995 | h->req_cnt = cpu_to_le16(hba->rq_count+1); |
1003 | h->status_sz = cpu_to_le16(sizeof(struct status_msg)); | 996 | h->status_sz = cpu_to_le16(sizeof(struct status_msg)); |
1004 | h->status_cnt = cpu_to_le16(hba->sts_count+1); | 997 | h->status_cnt = cpu_to_le16(hba->sts_count+1); |
1005 | stex_gettime(&h->hosttime); | 998 | h->hosttime = cpu_to_le64(ktime_get_real_seconds()); |
1006 | h->partner_type = HMU_PARTNER_TYPE; | 999 | h->partner_type = HMU_PARTNER_TYPE; |
1007 | if (hba->extra_offset) { | 1000 | if (hba->extra_offset) { |
1008 | h->extra_offset = cpu_to_le32(hba->extra_offset); | 1001 | h->extra_offset = cpu_to_le32(hba->extra_offset); |
@@ -1076,7 +1069,7 @@ static int stex_ss_handshake(struct st_hba *hba) | |||
1076 | h->req_cnt = cpu_to_le16(hba->rq_count+1); | 1069 | h->req_cnt = cpu_to_le16(hba->rq_count+1); |
1077 | h->status_sz = cpu_to_le16(sizeof(struct status_msg)); | 1070 | h->status_sz = cpu_to_le16(sizeof(struct status_msg)); |
1078 | h->status_cnt = cpu_to_le16(hba->sts_count+1); | 1071 | h->status_cnt = cpu_to_le16(hba->sts_count+1); |
1079 | stex_gettime(&h->hosttime); | 1072 | h->hosttime = cpu_to_le64(ktime_get_real_seconds()); |
1080 | h->partner_type = HMU_PARTNER_TYPE; | 1073 | h->partner_type = HMU_PARTNER_TYPE; |
1081 | h->extra_offset = h->extra_size = 0; | 1074 | h->extra_offset = h->extra_size = 0; |
1082 | scratch_size = (hba->sts_count+1)*sizeof(u32); | 1075 | scratch_size = (hba->sts_count+1)*sizeof(u32); |