public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>, passt-dev@passt.top
Cc: Laurent Vivier <lvivier@redhat.com>,
	David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH v2 1/3] tcp: Suppress new instance of cppcheck bug 14191
Date: Thu, 11 Dec 2025 14:54:34 +1100	[thread overview]
Message-ID: <20251211035436.2844623-2-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20251211035436.2844623-1-david@gibson.dropbear.id.au>

From: Laurent Vivier <lvivier@redhat.com>

ee9b2361d ("cppcheck: Suppress a buggy cppcheck warning") added a
a suppression for a cppchec bug, since filed (and fixed) in upstream
cppcheck as https://trac.cppcheck.net/ticket/14191.  9139e60fd ("tcp:
Acknowledge everything if it looks like bulk traffic, not interactive")
introduced a new point which triggers the same cppcheck bug.

Add a suppression for the new instance.  This is a revision of Laurent's
earlier patch, updating the comments to make the connection between the
two instances clear, and adding unmatchedSuppression so it doesn't cause
a bogus warning with unaffected cppcheck versions.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 tcp.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tcp.c b/tcp.c
index 7c721b4b..1711bcc7 100644
--- a/tcp.c
+++ b/tcp.c
@@ -1132,6 +1132,11 @@ int tcp_update_seqack_wnd(const struct ctx *c, struct tcp_tap_conn *conn,
 				return 0;
 		}
 
+		/* This trips a cppcheck bug in some versions, including
+		 * cppcheck 2.18.3.
+		 * https://trac.cppcheck.net/ticket/14191
+		 */
+		/* cppcheck-suppress [uninitvar,unmatchedSuppression] */
 		if ((unsigned)SNDBUF_GET(conn) > (long long)tinfo->tcpi_rtt *
 						 tinfo->tcpi_delivery_rate /
 						 1000 / 1000 *
@@ -1143,10 +1148,7 @@ int tcp_update_seqack_wnd(const struct ctx *c, struct tcp_tap_conn *conn,
 		/* Fall back to acknowledging everything we got */
 		conn->seq_ack_to_tap = conn->seq_from_tap;
 	} else {
-		/* This trips a cppcheck bug in some versions, including
-		 * cppcheck 2.18.3.
-		 * https://sourceforge.net/p/cppcheck/discussion/general/thread/fecde59085/
-		 */
+		/* cppcheck bug 14191 again, see above */
 		/* cppcheck-suppress [uninitvar,unmatchedSuppression] */
 		conn->seq_ack_to_tap = tinfo->tcpi_bytes_acked +
 		                       conn->seq_init_from_tap;
-- 
2.52.0


  reply	other threads:[~2025-12-11  3:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-11  3:54 [PATCH v2 0/3] Improved exit()/_exit() handling David Gibson
2025-12-11  3:54 ` David Gibson [this message]
2025-12-11  3:54 ` [PATCH v2 2/3] treewide: Introduce passt_exit() helper David Gibson
2025-12-11  3:54 ` [PATCH v2 3/3] pasta: Clean up waiting pasta child on failures David Gibson
2025-12-11  7:16   ` Stefano Brivio
2025-12-11  8:45     ` David Gibson
2025-12-11 13:52   ` Paul Holzinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251211035436.2844623-2-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=lvivier@redhat.com \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).