public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: passt-dev@passt.top, Stefano Brivio <sbrivio@redhat.com>
Cc: jmaloy@redhat.com, David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH v6] tcp: Make pointer const in tcp_revert_seq
Date: Thu,  6 Jun 2024 12:03:05 +1000	[thread overview]
Message-ID: <20240606020305.4125785-1-david@gibson.dropbear.id.au> (raw)

The th pointer could be const, which causes a cppcheck warning on at least
some cppcheck versions (e.g. Cppcheck 2.13.0 in Fedora 40).

Fixes: e84a01e94 "tcp: move seq_to_tap update to when frame is queued"

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 tcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tcp.c b/tcp.c
index 89a5b19a..ff1198dd 100644
--- a/tcp.c
+++ b/tcp.c
@@ -1261,8 +1261,8 @@ static void tcp_revert_seq(struct tcp_tap_conn **conns, struct iovec (*frames)[T
 	int i;
 
 	for (i = 0; i < num_frames; i++) {
+		const struct tcphdr *th = frames[i][TCP_IOV_PAYLOAD].iov_base;
 		struct tcp_tap_conn *conn = conns[i];
-		struct tcphdr *th = frames[i][TCP_IOV_PAYLOAD].iov_base;
 		uint32_t seq = ntohl(th->seq);
 
 		if (SEQ_LE(conn->seq_to_tap, seq))
-- 
@@ -1261,8 +1261,8 @@ static void tcp_revert_seq(struct tcp_tap_conn **conns, struct iovec (*frames)[T
 	int i;
 
 	for (i = 0; i < num_frames; i++) {
+		const struct tcphdr *th = frames[i][TCP_IOV_PAYLOAD].iov_base;
 		struct tcp_tap_conn *conn = conns[i];
-		struct tcphdr *th = frames[i][TCP_IOV_PAYLOAD].iov_base;
 		uint32_t seq = ntohl(th->seq);
 
 		if (SEQ_LE(conn->seq_to_tap, seq))
-- 
2.45.2


             reply	other threads:[~2024-06-06  2:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-06  2:03 David Gibson [this message]
2024-06-06  2:41 ` [PATCH v6] tcp: Make pointer const in tcp_revert_seq David Gibson

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=20240606020305.4125785-1-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=jmaloy@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).