aboutgitcodebugslistschat
path: root/tcp.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2023-09-29 15:50:22 +1000
committerStefano Brivio <sbrivio@redhat.com>2023-10-04 23:24:05 +0200
commit117b474f85f2b73278b2aa8930f1e3aa2b418373 (patch)
treef02b03bc2ac457af566b79c6fadc0c9467ccbf34 /tcp.c
parent8640d62af719ecb48ed8c8adb31fd99f02a6c49b (diff)
downloadpasst-117b474f85f2b73278b2aa8930f1e3aa2b418373.tar
passt-117b474f85f2b73278b2aa8930f1e3aa2b418373.tar.gz
passt-117b474f85f2b73278b2aa8930f1e3aa2b418373.tar.bz2
passt-117b474f85f2b73278b2aa8930f1e3aa2b418373.tar.lz
passt-117b474f85f2b73278b2aa8930f1e3aa2b418373.tar.xz
passt-117b474f85f2b73278b2aa8930f1e3aa2b418373.tar.zst
passt-117b474f85f2b73278b2aa8930f1e3aa2b418373.zip
cppcheck: Work around bug in cppcheck 2.12.0
cppcheck 2.12.0 (and maybe some other versions) things this if condition is always true, which is demonstrably not true. Work around the bug for now. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tcp.c')
-rw-r--r--tcp.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tcp.c b/tcp.c
index 1204e7b..a9a6f2a 100644
--- a/tcp.c
+++ b/tcp.c
@@ -1553,6 +1553,13 @@ static int tcp_update_seqack_wnd(const struct ctx *c, struct tcp_tap_conn *conn,
conn->wnd_to_tap = MIN(new_wnd_to_tap >> conn->ws_to_tap, USHRT_MAX);
+ /* Certain cppcheck versions, e.g. 2.12.0 have a bug where they think
+ * the MIN() above restricts conn->wnd_to_tap to be zero. That's
+ * clearly incorrect, but until the bug is fixed, work around it.
+ * https://bugzilla.redhat.com/show_bug.cgi?id=2240705
+ * https://sourceforge.net/p/cppcheck/discussion/general/thread/f5b1a00646/
+ */
+ /* cppcheck-suppress [knownConditionTrueFalse, unmatchedSuppression] */
if (!conn->wnd_to_tap)
conn_flag(c, conn, ACK_TO_TAP_DUE);