* [RESEND PATCH] [SCSI] mvumi: 64bit value for seconds_since1970
@ 2015-10-30 9:11 Tina Ruchandani
2015-10-30 9:35 ` Johannes Thumshirn
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Tina Ruchandani @ 2015-10-30 9:11 UTC (permalink / raw)
To: linux-scsi; +Cc: Arnd Bergmann, James E.J. Bottomley, y2038
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: Tina Ruchandani <ruchandani.tina@gmail.com>
---
drivers/scsi/mvumi.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c
index 3e6b866..02360de 100644
--- a/drivers/scsi/mvumi.c
+++ b/drivers/scsi/mvumi.c
@@ -31,6 +31,7 @@
#include <linux/spinlock.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
+#include <linux/ktime.h>
#include <linux/blkdev.h>
#include <linux/io.h>
#include <scsi/scsi.h>
@@ -858,8 +859,8 @@ static void mvumi_hs_build_page(struct mvumi_hba *mhba,
struct mvumi_hs_page2 *hs_page2;
struct mvumi_hs_page4 *hs_page4;
struct mvumi_hs_page3 *hs_page3;
- struct timeval time;
- unsigned int local_time;
+ u64 time;
+ u64 local_time;
switch (hs_header->page_code) {
case HS_PAGE_HOST_INFO:
@@ -877,9 +878,8 @@ static void mvumi_hs_build_page(struct mvumi_hba *mhba,
hs_page2->slot_number = 0;
hs_page2->intr_level = 0;
hs_page2->intr_vector = 0;
- do_gettimeofday(&time);
- local_time = (unsigned int) (time.tv_sec -
- (sys_tz.tz_minuteswest * 60));
+ time = ktime_get_real_seconds();
+ local_time = (time - (sys_tz.tz_minuteswest * 60));
hs_page2->seconds_since1970 = local_time;
hs_header->checksum = mvumi_calculate_checksum(hs_header,
hs_header->frame_length);
--
2.2.0.rc0.207.ga3a616c
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [RESEND PATCH] [SCSI] mvumi: 64bit value for seconds_since1970
2015-10-30 9:11 [RESEND PATCH] [SCSI] mvumi: 64bit value for seconds_since1970 Tina Ruchandani
@ 2015-10-30 9:35 ` Johannes Thumshirn
2015-11-05 16:31 ` [Y2038] " Arnd Bergmann
2015-11-12 1:47 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2015-10-30 9:35 UTC (permalink / raw)
To: Tina Ruchandani, linux-scsi; +Cc: Arnd Bergmann, James E.J. Bottomley, y2038
On Fri, 2015-10-30 at 02:11 -0700, Tina Ruchandani wrote:
> 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: Tina Ruchandani <ruchandani.tina@gmail.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
> ---
> drivers/scsi/mvumi.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c
> index 3e6b866..02360de 100644
> --- a/drivers/scsi/mvumi.c
> +++ b/drivers/scsi/mvumi.c
> @@ -31,6 +31,7 @@
> #include <linux/spinlock.h>
> #include <linux/interrupt.h>
> #include <linux/delay.h>
> +#include <linux/ktime.h>
> #include <linux/blkdev.h>
> #include <linux/io.h>
> #include <scsi/scsi.h>
> @@ -858,8 +859,8 @@ static void mvumi_hs_build_page(struct mvumi_hba
> *mhba,
> struct mvumi_hs_page2 *hs_page2;
> struct mvumi_hs_page4 *hs_page4;
> struct mvumi_hs_page3 *hs_page3;
> - struct timeval time;
> - unsigned int local_time;
> + u64 time;
> + u64 local_time;
>
> switch (hs_header->page_code) {
> case HS_PAGE_HOST_INFO:
> @@ -877,9 +878,8 @@ static void mvumi_hs_build_page(struct mvumi_hba
> *mhba,
> hs_page2->slot_number = 0;
> hs_page2->intr_level = 0;
> hs_page2->intr_vector = 0;
> - do_gettimeofday(&time);
> - local_time = (unsigned int) (time.tv_sec -
> - (sys_tz.tz_minuteswe
> st * 60));
> + time = ktime_get_real_seconds();
> + local_time = (time - (sys_tz.tz_minuteswest * 60));
> hs_page2->seconds_since1970 = local_time;
> hs_header->checksum =
> mvumi_calculate_checksum(hs_header,
> hs_header-
> >frame_length);
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Y2038] [RESEND PATCH] [SCSI] mvumi: 64bit value for seconds_since1970
2015-10-30 9:11 [RESEND PATCH] [SCSI] mvumi: 64bit value for seconds_since1970 Tina Ruchandani
2015-10-30 9:35 ` Johannes Thumshirn
@ 2015-11-05 16:31 ` Arnd Bergmann
2015-11-12 1:47 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2015-11-05 16:31 UTC (permalink / raw)
To: y2038; +Cc: Tina Ruchandani, linux-scsi, James E.J. Bottomley
On Friday 30 October 2015 02:11:10 Tina Ruchandani wrote:
> 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: Tina Ruchandani <ruchandani.tina@gmail.com>
> ---
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
and picked up into my y2038 tree temporarily until it shows up in scsi.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RESEND PATCH] [SCSI] mvumi: 64bit value for seconds_since1970
2015-10-30 9:11 [RESEND PATCH] [SCSI] mvumi: 64bit value for seconds_since1970 Tina Ruchandani
2015-10-30 9:35 ` Johannes Thumshirn
2015-11-05 16:31 ` [Y2038] " Arnd Bergmann
@ 2015-11-12 1:47 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2015-11-12 1:47 UTC (permalink / raw)
To: Tina Ruchandani; +Cc: y2038, James E.J. Bottomley, Arnd Bergmann, linux-scsi
>>>>> "Tina" == Tina Ruchandani <ruchandani.tina@gmail.com> writes:
Tina> struct mvumi_hs_page2 stores a "seconds_since1970" field which is
Tina> of type u64. It is however, written to, using 'struct timeval'
Tina> which has a 32-bit seconds field and whose value will overflow in
Tina> year 2038. This patch uses ktime_get_real_seconds() instead since
Tina> it provides a 64-bit seconds value, which is 2038 safe.
Under normal circumstances I would like a driver owner signoff but it
doesn't look like mvumi gets much attention. Applied.
--
Martin K. Petersen Oracle Linux Engineering
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-11-12 1:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-30 9:11 [RESEND PATCH] [SCSI] mvumi: 64bit value for seconds_since1970 Tina Ruchandani
2015-10-30 9:35 ` Johannes Thumshirn
2015-11-05 16:31 ` [Y2038] " Arnd Bergmann
2015-11-12 1:47 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).