scsi_transport_fc: use 64-bit timestamps consistently
PATCH 1/1 scsi_transport_fc: use 64-bit timestamps consistently
The get_seconds() helper returns an 'unsigned long' value, which can overflow on 32-bit architectures. Since the interface we pass it into already uses a 64-bit type, we can just use ktime_get_real_seconds() instead.
While we generally prefer local timestamps in CLOCK_MONOTONIC format (ktime_get_seconds), this keeps using the CLOCK_REALTIME version in order to maintain compatibility with existing code.
--- drivers/scsi/scsi_transport_fc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/scsi_transport_fc.c +2 -2
@@ -567,7 +567,7 @@ fc_host_post_event(struct Scsi_Host *shost, u32 event_number,INIT_SCSI_NL_HDR (&event->snlh,SCSI_NL_TRANSPORT_FC ,FC_NL_ASYNC_EVENT , len); - event->seconds =get_seconds (); + event->seconds =ktime_get_real_seconds (); event->vendor_id =0 ; event->host_no = shost->host_no; event->event_datalen =sizeof (u32);/* bytes */
@@ -635,7 +635,7 @@ fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number,INIT_SCSI_NL_HDR (&event->snlh,SCSI_NL_TRANSPORT_FC ,FC_NL_ASYNC_EVENT , len); - event->seconds =get_seconds (); + event->seconds =ktime_get_real_seconds (); event->vendor_id = vendor_id; event->host_no = shost->host_no; event->event_datalen = data_len;/* bytes */
Signature · 1 line
2.9.0
Looks good,
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Quoted 11 lines · Arnd Bergmann
The
get_seconds()helper returns an 'unsigned long' value, which can overflow on 32-bit architectures. Since the interface we pass it into already uses a 64-bit type, we can just usektime_get_real_seconds()instead.While we generally prefer local timestamps in
CLOCK_MONOTONICformat (ktime_get_seconds), this keeps using theCLOCK_REALTIMEversion in order to maintain compatibility with existing code.Signed-off-by Arnd Bergmann <[email protected]>---
_______________________________________________
Y2038 mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/y2038
Quoted 29 lines · Arnd Bergmann
The
get_seconds()helper returns an 'unsigned long' value, which can overflow on 32-bit architectures. Since the interface we pass it into already uses a 64-bit type, we can just usektime_get_real_seconds()instead.While we generally prefer local timestamps in
CLOCK_MONOTONICformat (ktime_get_seconds), this keeps using theCLOCK_REALTIMEversion in order to maintain compatibility with existing code.Signed-off-by Arnd Bergmann <[email protected]>--- drivers/scsi/scsi_transport_fc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/scsi/scsi_transport_fc.c +1
-1@@ -567,7 +567,7 @@ fc_host_post_event(struct Scsi_Host *shost, u32 event_number,INIT_SCSI_NL_HDR (&event->snlh,SCSI_NL_TRANSPORT_FC ,FC_NL_ASYNC_EVENT , len); - event->seconds =get_seconds (); + event->seconds =ktime_get_real_seconds (); event->vendor_id =0 ; event->host_no = shost->host_no; event->event_datalen =sizeof (u32);/* bytes */
drivers/scsi/scsi_transport_fc.c fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number, · line 641
Quoted 8 lines
drivers/scsi/scsi_transport_fc.c +1
-1@@ -635,7 +635,7 @@ fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number,INIT_SCSI_NL_HDR (&event->snlh,SCSI_NL_TRANSPORT_FC ,FC_NL_ASYNC_EVENT , len); - event->seconds =get_seconds (); + event->seconds =ktime_get_real_seconds (); event->vendor_id = vendor_id; event->host_no = shost->host_no; event->event_datalen = data_len;/* bytes */
looks good
Martin K. Petersen
AppliedArnd,
Quoted 8 lines
The
get_seconds()helper returns an 'unsigned long' value, which can overflow on 32-bit architectures. Since the interface we pass it into already uses a 64-bit type, we can just usektime_get_real_seconds()instead.While we generally prefer local timestamps in
CLOCK_MONOTONICformat (ktime_get_seconds), this keeps using theCLOCK_REALTIMEversion in order to maintain compatibility with existing code.
Applied to 4.19/scsi-queue, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering