netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: skb: do not assume that ktime_t is equal to s64
@ 2025-02-13 10:16 Dmitry Antipov
  2025-02-15  0:57 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Antipov @ 2025-02-13 10:16 UTC (permalink / raw)
  To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: netdev, Dmitry Antipov

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@yandex.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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] net: skb: do not assume that ktime_t is equal to s64
  2025-02-13 10:16 [PATCH net-next] net: skb: do not assume that ktime_t is equal to s64 Dmitry Antipov
@ 2025-02-15  0:57 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2025-02-15  0:57 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: David S . Miller, Eric Dumazet, Paolo Abeni, netdev

On Thu, 13 Feb 2025 13:16:58 +0300 Dmitry Antipov wrote:
> 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.

Is there a real bug here or you just run a scanner which checks 
if types match? As is the commit message doesn't really explain
what the potential problem is.

Also please run get_maintainer.pl on the patch, you missed two people.
-- 
pw-bot: cr

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-02-15  0:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-13 10:16 [PATCH net-next] net: skb: do not assume that ktime_t is equal to s64 Dmitry Antipov
2025-02-15  0:57 ` Jakub Kicinski

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).