]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tcp: only initialize sockcm tsflags field
authorWillem de Bruijn <willemb@google.com>
Fri, 14 Feb 2025 22:26:58 +0000 (17:26 -0500)
committerJakub Kicinski <kuba@kernel.org>
Wed, 19 Feb 2025 02:27:19 +0000 (18:27 -0800)
TCP only reads the tsflags field. Don't bother initializing others.

Signed-off-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://patch.msgid.link/20250214222720.3205500-2-willemdebruijn.kernel@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/tcp.c

index 5d78ab3b416e2d299252145d3881561ea7c61e15..6a8f19a10911a231414ebcbbc979c4a9fefb437a 100644 (file)
@@ -1127,7 +1127,7 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size)
                /* 'common' sending to sendq */
        }
 
-       sockcm_init(&sockc, sk);
+       sockc = (struct sockcm_cookie) { .tsflags = READ_ONCE(sk->sk_tsflags)};
        if (msg->msg_controllen) {
                err = sock_cmsg_send(sk, msg, &sockc);
                if (unlikely(err)) {