diff mbox series

[net-next] net: skb: do not assume that ktime_t is equal to s64

Message ID 20250213101658.1349753-1-dmantipov@yandex.ru (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: skb: do not assume that ktime_t is equal to s64 | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 42 this patch: 42
netdev/build_tools success Errors and warnings before: 26 (+1) this patch: 26 (+1)
netdev/cc_maintainers fail 1 blamed authors not CCed: willemb@google.com; 2 maintainers not CCed: willemb@google.com horms@kernel.org
netdev/build_clang success Errors and warnings before: 7662 this patch: 7662
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 4968 this patch: 4968
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 51 this patch: 51
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2025-02-13--12-00 (tests: 889)

Commit Message

Dmitry Antipov Feb. 13, 2025, 10:16 a.m. UTC
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(-)

Comments

Jakub Kicinski Feb. 15, 2025, 12:57 a.m. UTC | #1
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.
diff mbox series

Patch

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,