Add a second KASSERT checking for len >= 0 in the tcp output path.

This is different to the first one (as len gets updated between those
two) and would have caught various edge cases (read bugs) at a well
defined place I had been debugging the last months instead of
triggering (random) panics further down the call graph.

MFC after:	2 months
This commit is contained in:
Bjoern A. Zeeb 2008-09-07 11:38:30 +00:00
parent 1b856fa491
commit c4982fae59

View File

@ -392,7 +392,7 @@ after_sack_rexmit:
}
/* len will be >= 0 after this point. */
KASSERT(len >= 0, ("%s: len < 0", __func__));
KASSERT(len >= 0, ("[%s:%d]: len < 0", __func__, __LINE__));
/*
* Automatic sizing of send socket buffer. Often the send buffer
@ -745,6 +745,12 @@ send:
panic("tcphdr too big");
/*#endif*/
/*
* This KASSERT is here to catch edge cases at a well defined place.
* Before, those had triggered (random) panic conditions further down.
*/
KASSERT(len >= 0, ("[%s:%d]: len < 0", __func__, __LINE__));
/*
* Grab a header mbuf, attaching a copy of data to
* be transmitted, and initialize the header from