Skip to content

Commit 1032a66

Browse files
Tinabr7davem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1cf7d8d commit 1032a66

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

net/dccp/probe.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <linux/module.h>
3131
#include <linux/kfifo.h>
3232
#include <linux/vmalloc.h>
33+
#include <linux/time64.h>
3334
#include <linux/gfp.h>
3435
#include <net/net_namespace.h>
3536

@@ -47,20 +48,20 @@ static struct {
4748
struct kfifo fifo;
4849
spinlock_t lock;
4950
wait_queue_head_t wait;
50-
struct timespec tstart;
51+
struct timespec64 tstart;
5152
} dccpw;
5253

5354
static void printl(const char *fmt, ...)
5455
{
5556
va_list args;
5657
int len;
57-
struct timespec now;
58+
struct timespec64 now;
5859
char tbuf[256];
5960

6061
va_start(args, fmt);
61-
getnstimeofday(&now);
62+
getnstimeofday64(&now);
6263

63-
now = timespec_sub(now, dccpw.tstart);
64+
now = timespec64_sub(now, dccpw.tstart);
6465

6566
len = sprintf(tbuf, "%lu.%06lu ",
6667
(unsigned long) now.tv_sec,
@@ -110,7 +111,7 @@ static struct jprobe dccp_send_probe = {
110111
static int dccpprobe_open(struct inode *inode, struct file *file)
111112
{
112113
kfifo_reset(&dccpw.fifo);
113-
getnstimeofday(&dccpw.tstart);
114+
getnstimeofday64(&dccpw.tstart);
114115
return 0;
115116
}
116117

0 commit comments

Comments
 (0)