tcp: use signed IsLost() related accounting variables

Coverity found that one safety check (kassert) was not
functional, as possible incorrect subtractions during
the accounting wouldn't show up as (invalid) negative
values.

Reported by: gallatin
Reviewed By: cc, #transport
Sponsored By: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D42180
This commit is contained in:
Richard Scheffenegger 2023-10-17 16:07:23 +02:00
parent 4bd1e19684
commit 22dc8609c5
2 changed files with 4 additions and 4 deletions

View file

@ -888,10 +888,10 @@ tcp_free_sackholes(struct tcpcb *tp)
while ((q = TAILQ_FIRST(&tp->snd_holes)) != NULL)
tcp_sackhole_remove(tp, q);
tp->sackhint.sack_bytes_rexmit = 0;
tp->sackhint.sacked_bytes = 0;
tp->sackhint.delivered_data = 0;
tp->sackhint.lost_bytes = 0;
tp->sackhint.sacked_bytes = 0;
tp->sackhint.hole_bytes = 0;
tp->sackhint.lost_bytes = 0;
KASSERT(tp->snd_numholes == 0, ("tp->snd_numholes == 0"));
KASSERT(tp->sackhint.nexthole == NULL,

View file

@ -128,8 +128,8 @@ struct sackhint {
uint32_t recover_fs; /* Flight Size at the start of Loss recovery */
uint32_t prr_delivered; /* Total bytes delivered using PRR */
uint32_t prr_out; /* Bytes sent during IN_RECOVERY */
uint32_t hole_bytes; /* current number of bytes in scoreboard holes */
uint32_t lost_bytes; /* number of rfc6675 IsLost() bytes */
int32_t hole_bytes; /* current number of bytes in scoreboard holes */
int32_t lost_bytes; /* number of rfc6675 IsLost() bytes */
};
#define SEGQ_EMPTY(tp) TAILQ_EMPTY(&(tp)->t_segq)