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>] [thread-next>] [day] [month] [year] [list]
Date:   Mon,  4 Jun 2018 17:07:39 +0800
From:   Baolin Wang <baolin.wang@...aro.org>
To:     jic23@...nel.org
Cc:     baolin.wang@...aro.org, knaack.h@....de, lars@...afoo.de,
        pmeerw@...erw.net, arnd@...db.de, broonie@...nel.org,
        linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] iio: Convert to use timespec64 variables to get a time stamp

The struct timespec is not y2038 safe on 32bit machines, thus this patch
converts to use timespec64 variables and related APIs to get a time stamp
for events etc.

Signed-off-by: Baolin Wang <baolin.wang@...aro.org>
---
 drivers/iio/industrialio-core.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 19bdf3d..8d2b93b 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -207,35 +207,35 @@ static int iio_device_set_clock(struct iio_dev *indio_dev, clockid_t clock_id)
  */
 s64 iio_get_time_ns(const struct iio_dev *indio_dev)
 {
-	struct timespec tp;
+	struct timespec64 tp;
 
 	switch (iio_device_get_clock(indio_dev)) {
 	case CLOCK_REALTIME:
-		ktime_get_real_ts(&tp);
+		ktime_get_real_ts64(&tp);
 		break;
 	case CLOCK_MONOTONIC:
-		ktime_get_ts(&tp);
+		ktime_get_ts64(&tp);
 		break;
 	case CLOCK_MONOTONIC_RAW:
-		getrawmonotonic(&tp);
+		getrawmonotonic64(&tp);
 		break;
 	case CLOCK_REALTIME_COARSE:
-		tp = current_kernel_time();
+		tp = current_kernel_time64();
 		break;
 	case CLOCK_MONOTONIC_COARSE:
-		tp = get_monotonic_coarse();
+		tp = get_monotonic_coarse64();
 		break;
 	case CLOCK_BOOTTIME:
-		get_monotonic_boottime(&tp);
+		get_monotonic_boottime64(&tp);
 		break;
 	case CLOCK_TAI:
-		timekeeping_clocktai(&tp);
+		timekeeping_clocktai64(&tp);
 		break;
 	default:
 		BUG();
 	}
 
-	return timespec_to_ns(&tp);
+	return timespec64_to_ns(&tp);
 }
 EXPORT_SYMBOL(iio_get_time_ns);
 
-- 
1.7.9.5

Powered by blists - more mailing lists