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]
Message-Id: <20171127114159.2528123-1-arnd@arndb.de>
Date:   Mon, 27 Nov 2017 12:41:38 +0100
From:   Arnd Bergmann <arnd@...db.de>
To:     Pravin Shelar <pshelar@...ira.com>,
        "David S. Miller" <davem@...emloft.net>
Cc:     y2038@...ts.linaro.org, Arnd Bergmann <arnd@...db.de>,
        Pravin B Shelar <pshelar@....org>,
        Tonghao Zhang <xiangxia.m.yue@...il.com>,
        Jiri Benc <jbenc@...hat.com>,
        Willem de Bruijn <willemb@...gle.com>,
        Jarno Rajahalme <jarno@....org>,
        Yi-Hung Wei <yihung.wei@...il.com>,
        Yi Yang <yi.y.yang@...el.com>, netdev@...r.kernel.org,
        dev@...nvswitch.org, linux-kernel@...r.kernel.org
Subject: [PATCH] openvswitch: use ktime_get_ts64() instead of ktime_get_ts()

timespec is deprecated because of the y2038 overflow, so let's convert
this one to ktime_get_ts64(). The code is already safe even on 32-bit
architectures, since it uses monotonic times. On 64-bit architectures,
nothing changes, while on 32-bit architectures this avoids one
type conversion.

Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
 net/openvswitch/flow.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c
index dbe2379329c5..76d050aba7a4 100644
--- a/net/openvswitch/flow.c
+++ b/net/openvswitch/flow.c
@@ -56,12 +56,12 @@
 
 u64 ovs_flow_used_time(unsigned long flow_jiffies)
 {
-	struct timespec cur_ts;
+	struct timespec64 cur_ts;
 	u64 cur_ms, idle_ms;
 
-	ktime_get_ts(&cur_ts);
+	ktime_get_ts64(&cur_ts);
 	idle_ms = jiffies_to_msecs(jiffies - flow_jiffies);
-	cur_ms = (u64)cur_ts.tv_sec * MSEC_PER_SEC +
+	cur_ms = (u64)(u32)cur_ts.tv_sec * MSEC_PER_SEC +
 		 cur_ts.tv_nsec / NSEC_PER_MSEC;
 
 	return cur_ms - idle_ms;
-- 
2.9.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ