* [PATCH] tcp: Suppress false positive cppcheck warning in tcp_update_seqack_wnd()
@ 2025-12-09 13:49 Laurent Vivier
2025-12-09 22:55 ` David Gibson
0 siblings, 1 reply; 2+ messages in thread
From: Laurent Vivier @ 2025-12-09 13:49 UTC (permalink / raw)
To: passt-dev; +Cc: Laurent Vivier
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 <lvivier@redhat.com>
---
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 */
if ((unsigned)SNDBUF_GET(conn) > (long long)tinfo->tcpi_rtt *
tinfo->tcpi_delivery_rate /
1000 / 1000 *
--
2.51.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] tcp: Suppress false positive cppcheck warning in tcp_update_seqack_wnd()
2025-12-09 13:49 [PATCH] tcp: Suppress false positive cppcheck warning in tcp_update_seqack_wnd() Laurent Vivier
@ 2025-12-09 22:55 ` David Gibson
0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2025-12-09 22:55 UTC (permalink / raw)
To: Laurent Vivier; +Cc: passt-dev
[-- Attachment #1: Type: text/plain, Size: 1423 bytes --]
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 <lvivier@redhat.com>
> ---
> 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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-12-09 22:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-09 13:49 [PATCH] tcp: Suppress false positive cppcheck warning in tcp_update_seqack_wnd() Laurent Vivier
2025-12-09 22:55 ` David Gibson
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).