* [PATCH] [DCCP]: Use 64-bit timekeeping
@ 2015-10-30 8:24 Tina Ruchandani
2015-11-01 22:01 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Tina Ruchandani @ 2015-10-30 8:24 UTC (permalink / raw)
To: dccp; +Cc: y2038, netdev, davem, arnd, linux-kernel
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>
---
net/dccp/probe.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/net/dccp/probe.c b/net/dccp/probe.c
index d8346d0..3d3fda0 100644
--- a/net/dccp/probe.c
+++ b/net/dccp/probe.c
@@ -30,6 +30,7 @@
#include <linux/module.h>
#include <linux/kfifo.h>
#include <linux/vmalloc.h>
+#include <linux/time64.h>
#include <linux/gfp.h>
#include <net/net_namespace.h>
@@ -47,20 +48,20 @@ static struct {
struct kfifo fifo;
spinlock_t lock;
wait_queue_head_t wait;
- struct timespec tstart;
+ struct timespec64 tstart;
} dccpw;
static void printl(const char *fmt, ...)
{
va_list args;
int len;
- struct timespec now;
+ struct timespec64 now;
char tbuf[256];
va_start(args, fmt);
- getnstimeofday(&now);
+ getnstimeofday64(&now);
- now = timespec_sub(now, dccpw.tstart);
+ now = timespec64_sub(now, dccpw.tstart);
len = sprintf(tbuf, "%lu.%06lu ",
(unsigned long) now.tv_sec,
@@ -110,7 +111,7 @@ static struct jprobe dccp_send_probe = {
static int dccpprobe_open(struct inode *inode, struct file *file)
{
kfifo_reset(&dccpw.fifo);
- getnstimeofday(&dccpw.tstart);
+ getnstimeofday64(&dccpw.tstart);
return 0;
}
--
1.9.1
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] [DCCP]: Use 64-bit timekeeping
2015-10-30 8:24 [PATCH] [DCCP]: Use 64-bit timekeeping Tina Ruchandani
@ 2015-11-01 22:01 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-11-01 22:01 UTC (permalink / raw)
To: ruchandani.tina; +Cc: dccp, arnd, y2038, netdev, linux-kernel
From: Tina Ruchandani <ruchandani.tina@gmail.com>
Date: Fri, 30 Oct 2015 01:24:56 -0700
> 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>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-11-01 22:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-30 8:24 [PATCH] [DCCP]: Use 64-bit timekeeping Tina Ruchandani
2015-11-01 22:01 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).