git: b95d16f39d68 - stable/14 - tcp: improve initializing the fields in tcp_log_buffer

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Mon, 07 Apr 2025 12:53:38 UTC
The branch stable/14 has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=b95d16f39d68b6cb85fbfd7786e801f841bd24cb

commit b95d16f39d68b6cb85fbfd7786e801f841bd24cb
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2025-04-03 06:59:46 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2025-04-07 12:53:07 +0000

    tcp: improve initializing the fields in tcp_log_buffer
    
    Initialize the fields in the tcp_log_buffer in the sequence they
    appear in the structure and add the initialization of tlb_flex1,
    tlb_flex2, and _pad[].
    
    Reviewed by:            rrs, Peter Lei
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D49652
    
    (cherry picked from commit 94acddd2ad0142221124c3fb7fe3778a5a1f8036)
---
 sys/netinet/tcp_log_buf.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/sys/netinet/tcp_log_buf.c b/sys/netinet/tcp_log_buf.c
index 7b937958a4fb..e9ad05382b81 100644
--- a/sys/netinet/tcp_log_buf.c
+++ b/sys/netinet/tcp_log_buf.c
@@ -1857,16 +1857,21 @@ retry:
 	COPY_STAT_T(rttvar);
 	COPY_STAT(rcv_up);
 	COPY_STAT(rcv_adv);
+	COPY_STAT_T(flags2);
 	COPY_STAT(rcv_nxt);
 	COPY_STAT(rcv_wnd);
 	COPY_STAT_T(dupacks);
 	COPY_STAT_T(segqlen);
 	COPY_STAT(snd_numholes);
-	COPY_STAT(snd_scale);
-	COPY_STAT(rcv_scale);
-	COPY_STAT_T(flags2);
+	log_buf->tlb_flex1 = 0;
+	log_buf->tlb_flex2 = 0;
 	COPY_STAT_T(fbyte_in);
 	COPY_STAT_T(fbyte_out);
+	COPY_STAT(snd_scale);
+	COPY_STAT(rcv_scale);
+	log_buf->_pad[0] = 0;
+	log_buf->_pad[1] = 0;
+	log_buf->_pad[2] = 0;
 #undef COPY_STAT
 #undef COPY_STAT_T
 	/* Copy stack-specific info. */