OSDN Git Service

ipv6: xfrm: use 64-bit timestamps
authorArnd Bergmann <arnd@arndb.de>
Wed, 11 Jul 2018 10:19:14 +0000 (12:19 +0200)
committerSteffen Klassert <steffen.klassert@secunet.com>
Wed, 11 Jul 2018 13:26:35 +0000 (15:26 +0200)
get_seconds() is deprecated because it can overflow on 32-bit
architectures.  For the xfrm_state->lastused member, we treat the data
as a 64-bit number already, so we just need to use the right accessor
that works on both 32-bit and 64-bit machines.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
include/net/xfrm.h
net/ipv6/xfrm6_mode_ro.c

index a537861..1350e2c 100644 (file)
@@ -227,7 +227,7 @@ struct xfrm_state {
        long            saved_tmo;
 
        /* Last used time */
-       unsigned long           lastused;
+       time64_t                lastused;
 
        struct page_frag xfrag;
 
index 07d3657..da28e44 100644 (file)
@@ -55,7 +55,7 @@ static int xfrm6_ro_output(struct xfrm_state *x, struct sk_buff *skb)
        __skb_pull(skb, hdr_len);
        memmove(ipv6_hdr(skb), iph, hdr_len);
 
-       x->lastused = get_seconds();
+       x->lastused = ktime_get_real_seconds();
 
        return 0;
 }