lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Sat, 9 Jan 2016 20:06:55 +0530
From:	Amitoj Kaur Chawla <amitoj1606@...il.com>
To:	anil.gurumurthy@...gic.com, sudarsana.kalluru@...gic.com,
	JBottomley@...n.com, linux-scsi@...r.kernel.org,
	linux-kernel@...r.kernel.org, y2038@...ts.linaro.org
Subject: [PATCH 6/6] scsi: bfa: bfa_cs: Remove struct timeval

32 bit systems using 'struct timeval' will break in the year 2038, so
we replace the code appropriately.

This patch replaces struct timeval and do_gettimeofday() with
monotonic ktime_get_ns(). Since we are interested in microseconds
portion of the time, we can use NSEC_PER_USEC macro but this would
lead to expensive division for a frequently used function.

Alternatively a bit shift has been done which performs a division of
1024 instead of 1000 which slightly alters the value returned by this
function.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@...il.com>
---
 drivers/scsi/bfa/bfa_cs.h | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/scsi/bfa/bfa_cs.h b/drivers/scsi/bfa/bfa_cs.h
index 91a8aa3..daee860 100644
--- a/drivers/scsi/bfa/bfa_cs.h
+++ b/drivers/scsi/bfa/bfa_cs.h
@@ -32,13 +32,7 @@
 #define BFA_TRC_MAX	(4 * 1024)
 #endif
 
-#define BFA_TRC_TS(_trcm)                               \
-	({                                              \
-		struct timeval tv;                      \
-							\
-		do_gettimeofday(&tv);                   \
-		(tv.tv_sec*1000000+tv.tv_usec);         \
-	})
+#define BFA_TRC_TS(_trcm)	(ktime_get_ns() >> 10)
 
 #ifndef BFA_TRC_TS
 #define BFA_TRC_TS(_trcm)	((_trcm)->ticks++)
-- 
1.9.1

Powered by blists - more mailing lists