git: 7f328eb439a3 - stable/13 - tcp hpts: initialize variable

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Thu, 01 Aug 2024 20:32:44 UTC
The branch stable/13 has been updated by tuexen:

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

commit 7f328eb439a32176b4e6d00c0d4d3fdff53a06ee
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2024-04-05 15:30:31 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2024-08-01 20:32:02 +0000

    tcp hpts: initialize variable
    
    Ensure that  tv.tv_sec is zero in all code paths.
    
    Reported by:            Coverity Scan
    CID:                    1527724
    Reviewed by:            rscheff
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D44584
    
    (cherry picked from commit aaaa01c0c858fd703194c6cbd515dd514574381f)
---
 sys/netinet/tcp_hpts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/netinet/tcp_hpts.c b/sys/netinet/tcp_hpts.c
index 4c177367a7ea..ee4e68572c47 100644
--- a/sys/netinet/tcp_hpts.c
+++ b/sys/netinet/tcp_hpts.c
@@ -1995,6 +1995,7 @@ tcp_hpts_thread(void *ctx)
 		 * enough activity in the system that we don't need to
 		 * run as often (if we were not directly woken).
 		 */
+		tv.tv_sec = 0;
 		if (hpts->p_direct_wake == 0) {
 			counter_u64_add(hpts_back_tosleep, 1);
 			if (hpts->p_on_queue_cnt >= conn_cnt_thresh) {
@@ -2019,7 +2020,6 @@ tcp_hpts_thread(void *ctx)
 			 * Directly woken most likely to reset the
 			 * callout time.
 			 */
-			tv.tv_sec = 0;
 			tv.tv_usec = hpts->p_mysleep.tv_usec;
 		}
 		goto back_to_sleep;