Skip to content

Commit

Permalink
openvswitch: use ktime_get_ts64() instead of ktime_get_ts()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Arnd Bergmann authored and David S. Miller committed Nov 30, 2017
1 parent b2dfcb3 commit 311af51
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/openvswitch/flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 311af51

Please sign in to comment.