[PATCH 13/37] staging/lustre: use 64-bit ibn_incarnation computation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ibn_incarnation is a 64-bit value, but using timeval to compute
it will cause an overflow in 2038. This changes it to use
ktime_get_real_ts64() instead.

Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
---
 drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
index faa70f0b9b1e..5a157a744a7d 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
@@ -2749,7 +2749,7 @@ int kiblnd_startup(lnet_ni_t *ni)
 	char *ifname;
 	kib_dev_t *ibdev = NULL;
 	kib_net_t *net;
-	struct timeval tv;
+	struct timespec64 tv;
 	unsigned long flags;
 	int rc;
 	int newdev;
@@ -2767,8 +2767,8 @@ int kiblnd_startup(lnet_ni_t *ni)
 	if (net == NULL)
 		goto net_failed;
 
-	do_gettimeofday(&tv);
-	net->ibn_incarnation = (((__u64)tv.tv_sec) * 1000000) + tv.tv_usec;
+	ktime_get_real_ts64(&tv);
+	net->ibn_incarnation = tv.tv_sec * USEC_PER_SEC + tv.tv_nsec / NSEC_PER_USEC;
 
 	ni->ni_peertimeout    = *kiblnd_tunables.kib_peertimeout;
 	ni->ni_maxtxcredits   = *kiblnd_tunables.kib_credits;
-- 
2.1.0.rc2

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux