[PATCH] tcp: Suppress false positive cppcheck warning in tcp_update_seqack_wnd()
Cppcheck doesn't track that tinfo is reassigned to &tinfo_new when NULL,
leading to a false uninitvar warning at line 1099. Add inline suppression.
Signed-off-by: Laurent Vivier
On Tue, Dec 09, 2025 at 02:49:04PM +0100, Laurent Vivier wrote:
Cppcheck doesn't track that tinfo is reassigned to &tinfo_new when NULL, leading to a false uninitvar warning at line 1099. Add inline suppression.
I think this is the same cppcheck bug as I encountered, a dozen or so lines below this. See https://sourceforge.net/p/cppcheck/discussion/general/thread/fecde59085/ and/or https://trac.cppcheck.net/ticket/14191
Signed-off-by: Laurent Vivier
--- tcp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tcp.c b/tcp.c index 17fda5dcd7db..8dabfd3042d2 100644 --- a/tcp.c +++ b/tcp.c @@ -1132,6 +1132,7 @@ int tcp_update_seqack_wnd(const struct ctx *c, struct tcp_tap_conn *conn, return 0; }
+ /* cppcheck-suppress uninitvar */
Like the other case, I think we'll need unmatchedSuppression here, or we'll get the unmatched suppression warning once using a fixed version of cppcheck. Possibly also with earlier cppcheck versions that didn't trip on this.
if ((unsigned)SNDBUF_GET(conn) > (long long)tinfo->tcpi_rtt * tinfo->tcpi_delivery_rate / 1000 / 1000 * -- 2.51.1
-- David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson
participants (2)
-
David Gibson
-
Laurent Vivier