aboutsummaryrefslogtreecommitdiffstats
path: root/net/openvswitch/flow.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2017-11-27 06:41:38 -0500
committerDavid S. Miller <davem@davemloft.net>2017-11-30 09:26:32 -0500
commit311af51dcb5629f04976a8e451673f77e3301041 (patch)
tree9dc97dea04bbc8493830a0dd464f6620e5d09f96 /net/openvswitch/flow.c
parentb2dfcb3f83258de1aa396bd9f57321e2ff29b781 (diff)
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@arndb.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/openvswitch/flow.c')
-rw-r--r--net/openvswitch/flow.c6
1 files 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 @@
56 56
57u64 ovs_flow_used_time(unsigned long flow_jiffies) 57u64 ovs_flow_used_time(unsigned long flow_jiffies)
58{ 58{
59 struct timespec cur_ts; 59 struct timespec64 cur_ts;
60 u64 cur_ms, idle_ms; 60 u64 cur_ms, idle_ms;
61 61
62 ktime_get_ts(&cur_ts); 62 ktime_get_ts64(&cur_ts);
63 idle_ms = jiffies_to_msecs(jiffies - flow_jiffies); 63 idle_ms = jiffies_to_msecs(jiffies - flow_jiffies);
64 cur_ms = (u64)cur_ts.tv_sec * MSEC_PER_SEC + 64 cur_ms = (u64)(u32)cur_ts.tv_sec * MSEC_PER_SEC +
65 cur_ts.tv_nsec / NSEC_PER_MSEC; 65 cur_ts.tv_nsec / NSEC_PER_MSEC;
66 66
67 return cur_ms - idle_ms; 67 return cur_ms - idle_ms;