git: d341a5645144 - stable/13 - tcp hpts: improve consistency

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

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

commit d341a5645144da014cb800dc98ed5c785df504f4
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2024-04-01 19:51:59 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2024-08-01 20:28:16 +0000

    tcp hpts: improve consistency
    
    The target_slot argument of max_slots_available() can be NULL.
    Therefore, check for this in all places.
    Right now, all callers provide non-NULL pointer.
    
    Reported by:            Coverity Scan
    CID:                    1527732
    Reviewed by:            rrs
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D44527
    
    (cherry picked from commit b600644fdd6cefb1b90d76fdd5aa595946611a7d)
---
 sys/netinet/tcp_hpts.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/netinet/tcp_hpts.c b/sys/netinet/tcp_hpts.c
index 18576e181b6f..4c177367a7ea 100644
--- a/sys/netinet/tcp_hpts.c
+++ b/sys/netinet/tcp_hpts.c
@@ -796,7 +796,8 @@ max_slots_available(struct tcp_hpts_entry *hpts, uint32_t wheel_slot, uint32_t *
 		 * "0".
 		 */
 		counter_u64_add(combined_wheel_wrap, 1);
-		*target_slot = hpts->p_nxt_slot;
+		if (target_slot)
+			*target_slot = hpts->p_nxt_slot;
 		return (0);
 	} else {
 		/*