Skip to content

Commit

Permalink
net: sctp: Convert log timestamps to be y2038 safe
Browse files Browse the repository at this point in the history
SCTP probe log timestamps use struct timespec which is
not y2038 safe.
Use struct timespec64 which is 2038 safe instead.

Use monotonic time instead of real time as only time
differences are logged.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Cc: Vlad Yasevich <vyasevich@gmail.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: linux-sctp@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Deepa Dinamani authored and David S. Miller committed Mar 1, 2016
1 parent b1b270d commit 6497c7e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions net/sctp/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static struct {
struct kfifo fifo;
spinlock_t lock;
wait_queue_head_t wait;
struct timespec tstart;
struct timespec64 tstart;
} sctpw;

static __printf(1, 2) void printl(const char *fmt, ...)
Expand All @@ -85,7 +85,7 @@ static __printf(1, 2) void printl(const char *fmt, ...)
static int sctpprobe_open(struct inode *inode, struct file *file)
{
kfifo_reset(&sctpw.fifo);
getnstimeofday(&sctpw.tstart);
ktime_get_ts64(&sctpw.tstart);

return 0;
}
Expand Down Expand Up @@ -138,7 +138,7 @@ static sctp_disposition_t jsctp_sf_eat_sack(struct net *net,
struct sk_buff *skb = chunk->skb;
struct sctp_transport *sp;
static __u32 lcwnd = 0;
struct timespec now;
struct timespec64 now;

sp = asoc->peer.primary_path;

Expand All @@ -149,8 +149,8 @@ static sctp_disposition_t jsctp_sf_eat_sack(struct net *net,
(full || sp->cwnd != lcwnd)) {
lcwnd = sp->cwnd;

getnstimeofday(&now);
now = timespec_sub(now, sctpw.tstart);
ktime_get_ts64(&now);
now = timespec64_sub(now, sctpw.tstart);

printl("%lu.%06lu ", (unsigned long) now.tv_sec,
(unsigned long) now.tv_nsec / NSEC_PER_USEC);
Expand Down

0 comments on commit 6497c7e

Please sign in to comment.