Commit 36f8ef7f authored by Tina Ruchandani's avatar Tina Ruchandani Committed by Martin K. Petersen

mvumi: 64bit value for seconds_since1970

struct mvumi_hs_page2 stores a "seconds_since1970" field which is of
type u64. It is however, written to, using 'struct timeval' which has
a 32-bit seconds field and whose value will overflow in year 2038.
This patch uses ktime_get_real_seconds() instead since it provides a
64-bit seconds value, which is 2038 safe.
Signed-off-by: default avatarTina Ruchandani <ruchandani.tina@gmail.com>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent dd29dae0
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/ktime.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <linux/io.h> #include <linux/io.h>
#include <scsi/scsi.h> #include <scsi/scsi.h>
...@@ -858,8 +859,8 @@ static void mvumi_hs_build_page(struct mvumi_hba *mhba, ...@@ -858,8 +859,8 @@ static void mvumi_hs_build_page(struct mvumi_hba *mhba,
struct mvumi_hs_page2 *hs_page2; struct mvumi_hs_page2 *hs_page2;
struct mvumi_hs_page4 *hs_page4; struct mvumi_hs_page4 *hs_page4;
struct mvumi_hs_page3 *hs_page3; struct mvumi_hs_page3 *hs_page3;
struct timeval time; u64 time;
unsigned int local_time; u64 local_time;
switch (hs_header->page_code) { switch (hs_header->page_code) {
case HS_PAGE_HOST_INFO: case HS_PAGE_HOST_INFO:
...@@ -877,9 +878,8 @@ static void mvumi_hs_build_page(struct mvumi_hba *mhba, ...@@ -877,9 +878,8 @@ static void mvumi_hs_build_page(struct mvumi_hba *mhba,
hs_page2->slot_number = 0; hs_page2->slot_number = 0;
hs_page2->intr_level = 0; hs_page2->intr_level = 0;
hs_page2->intr_vector = 0; hs_page2->intr_vector = 0;
do_gettimeofday(&time); time = ktime_get_real_seconds();
local_time = (unsigned int) (time.tv_sec - local_time = (time - (sys_tz.tz_minuteswest * 60));
(sys_tz.tz_minuteswest * 60));
hs_page2->seconds_since1970 = local_time; hs_page2->seconds_since1970 = local_time;
hs_header->checksum = mvumi_calculate_checksum(hs_header, hs_header->checksum = mvumi_calculate_checksum(hs_header,
hs_header->frame_length); hs_header->frame_length);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment