[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250213101658.1349753-1-dmantipov@yandex.ru>
Date: Thu, 13 Feb 2025 13:16:58 +0300
From: Dmitry Antipov <dmantipov@...dex.ru>
To: "David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
Cc: netdev@...r.kernel.org,
Dmitry Antipov <dmantipov@...dex.ru>
Subject: [PATCH net-next] net: skb: do not assume that ktime_t is equal to s64
In 'skb_get_timestamp()', do not assume that 'tstamp' of 'struct
sk_buff' (which is 'ktime_t') may be implicitly converted to 's64'
(which is expected by 'ns_to_kernel_old_timeval()') but use
the convenient 'ktime_to_ns()' instead. Compile tested only.
Fixes: 13c6ee2a9216 ("socket: Use old_timeval types for socket timestamps")
Signed-off-by: Dmitry Antipov <dmantipov@...dex.ru>
---
include/linux/skbuff.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index bb2b751d274a..200b1dc48b27 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -4307,7 +4307,7 @@ static inline ktime_t skb_get_ktime(const struct sk_buff *skb)
static inline void skb_get_timestamp(const struct sk_buff *skb,
struct __kernel_old_timeval *stamp)
{
- *stamp = ns_to_kernel_old_timeval(skb->tstamp);
+ *stamp = ns_to_kernel_old_timeval(ktime_to_ns(skb->tstamp));
}
static inline void skb_get_new_timestamp(const struct sk_buff *skb,
--
2.48.1
Powered by blists - more mailing lists