aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp
diff options
context:
space:
mode:
authorTina Ruchandani <ruchandani.tina@gmail.com>2015-10-30 04:24:56 -0400
committerDavid S. Miller <davem@davemloft.net>2015-11-01 17:01:16 -0500
commit1032a6687168af9509615879d513f77e4049062e (patch)
treea3350d57a512f7c167b9986b90162068aa175f39 /net/dccp
parent1cf7d8dda2bd1704ca8552c93d5475af444a986b (diff)
Use 64-bit timekeeping
This patch changes the use of struct timespec in dccp_probe to use struct timespec64 instead. timespec uses a 32-bit seconds field which will overflow in the year 2038 and beyond. timespec64 uses a 64-bit seconds field. Note that the correctness of the code isn't changed, since the original code only uses the timestamps to compute a small elapsed interval. This patch is part of a larger attempt to remove instances of 32-bit timekeeping structures (timespec, timeval, time_t) from the kernel so it is easier to identify where the real 2038 issues are. Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp')
-rw-r--r--net/dccp/probe.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/net/dccp/probe.c b/net/dccp/probe.c
index d8346d0eadeb..3d3fda05b32d 100644
--- a/net/dccp/probe.c
+++ b/net/dccp/probe.c
@@ -30,6 +30,7 @@
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/kfifo.h> 31#include <linux/kfifo.h>
32#include <linux/vmalloc.h> 32#include <linux/vmalloc.h>
33#include <linux/time64.h>
33#include <linux/gfp.h> 34#include <linux/gfp.h>
34#include <net/net_namespace.h> 35#include <net/net_namespace.h>
35 36
@@ -47,20 +48,20 @@ static struct {
47 struct kfifo fifo; 48 struct kfifo fifo;
48 spinlock_t lock; 49 spinlock_t lock;
49 wait_queue_head_t wait; 50 wait_queue_head_t wait;
50 struct timespec tstart; 51 struct timespec64 tstart;
51} dccpw; 52} dccpw;
52 53
53static void printl(const char *fmt, ...) 54static void printl(const char *fmt, ...)
54{ 55{
55 va_list args; 56 va_list args;
56 int len; 57 int len;
57 struct timespec now; 58 struct timespec64 now;
58 char tbuf[256]; 59 char tbuf[256];
59 60
60 va_start(args, fmt); 61 va_start(args, fmt);
61 getnstimeofday(&now); 62 getnstimeofday64(&now);
62 63
63 now = timespec_sub(now, dccpw.tstart); 64 now = timespec64_sub(now, dccpw.tstart);
64 65
65 len = sprintf(tbuf, "%lu.%06lu ", 66 len = sprintf(tbuf, "%lu.%06lu ",
66 (unsigned long) now.tv_sec, 67 (unsigned long) now.tv_sec,
@@ -110,7 +111,7 @@ static struct jprobe dccp_send_probe = {
110static int dccpprobe_open(struct inode *inode, struct file *file) 111static int dccpprobe_open(struct inode *inode, struct file *file)
111{ 112{
112 kfifo_reset(&dccpw.fifo); 113 kfifo_reset(&dccpw.fifo);
113 getnstimeofday(&dccpw.tstart); 114 getnstimeofday64(&dccpw.tstart);
114 return 0; 115 return 0;
115} 116}
116 117