From: Arnd Bergmann <arnd@arndb.de>
To: Pravin Shelar <pshelar@nicira.com>,
"David S. Miller" <davem@davemloft.net>
Cc: dev@openvswitch.org, Willem de Bruijn <willemb@google.com>,
Arnd Bergmann <arnd@arndb.de>,
y2038@lists.linaro.org, netdev@vger.kernel.org,
Yi-Hung Wei <yihung.wei@gmail.com>, Jiri Benc <jbenc@redhat.com>,
Pravin B Shelar <pshelar@ovn.org>, Yi Yang <yi.y.yang@intel.com>,
Tonghao Zhang <xiangxia.m.yue@gmail.com>,
Jarno Rajahalme <jarno@ovn.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH] openvswitch: use ktime_get_ts64() instead of ktime_get_ts()
Date: Mon, 27 Nov 2017 12:41:38 +0100 [thread overview]
Message-ID: <20171127114159.2528123-1-arnd@arndb.de> (raw)
timespec is deprecated because of the y2038 overflow, so let's convert
this one to ktime_get_ts64(). The code is already safe even on 32-bit
architectures, since it uses monotonic times. On 64-bit architectures,
nothing changes, while on 32-bit architectures this avoids one
type conversion.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
net/openvswitch/flow.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c
index dbe2379329c5..76d050aba7a4 100644
--- a/net/openvswitch/flow.c
+++ b/net/openvswitch/flow.c
@@ -56,12 +56,12 @@
u64 ovs_flow_used_time(unsigned long flow_jiffies)
{
- struct timespec cur_ts;
+ struct timespec64 cur_ts;
u64 cur_ms, idle_ms;
- ktime_get_ts(&cur_ts);
+ ktime_get_ts64(&cur_ts);
idle_ms = jiffies_to_msecs(jiffies - flow_jiffies);
- cur_ms = (u64)cur_ts.tv_sec * MSEC_PER_SEC +
+ cur_ms = (u64)(u32)cur_ts.tv_sec * MSEC_PER_SEC +
cur_ts.tv_nsec / NSEC_PER_MSEC;
return cur_ms - idle_ms;
--
2.9.0
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038
next reply other threads:[~2017-11-27 11:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-27 11:41 Arnd Bergmann [this message]
2017-11-28 4:59 ` [PATCH] openvswitch: use ktime_get_ts64() instead of ktime_get_ts() Pravin Shelar
[not found] ` <CAOrHB_AqrW=46=YbyMi8LvoFmcTvFXD8epTmJz5DmBNTqOGiCw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-28 8:50 ` Arnd Bergmann
[not found] ` <20171127114159.2528123-1-arnd-r2nGTMty4D4@public.gmane.org>
2017-11-30 14:27 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171127114159.2528123-1-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=dev@openvswitch.org \
--cc=jarno@ovn.org \
--cc=jbenc@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pshelar@nicira.com \
--cc=pshelar@ovn.org \
--cc=willemb@google.com \
--cc=xiangxia.m.yue@gmail.com \
--cc=y2038@lists.linaro.org \
--cc=yi.y.yang@intel.com \
--cc=yihung.wei@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox