openvswitch: use ktime_get_ts64() instead of ktime_get_ts()
authorArnd Bergmann <arnd@arndb.de>
Mon, 27 Nov 2017 11:41:38 +0000 (12:41 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 30 Nov 2017 14:26:32 +0000 (09:26 -0500)
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>
net/openvswitch/flow.c

index dbe2379329c5517fb164b6024d40fabebe7855c8..76d050aba7a481ff8e0229b810d563a0eeaa0ec3 100644 (file)
 
 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;