aboutgitcodebugslistschat
path: root/tcp.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2022-01-30 02:59:12 +0100
committerStefano Brivio <sbrivio@redhat.com>2022-01-30 02:59:12 +0100
commit292c1855531df7baab095ef608cda7240984340b (patch)
treedd5bc98e5b9beaf7721c87542fe37485dd712f37 /tcp.c
parent20d271b22604fc11a0b75fee52b89a6654c67db6 (diff)
downloadpasst-292c1855531df7baab095ef608cda7240984340b.tar
passt-292c1855531df7baab095ef608cda7240984340b.tar.gz
passt-292c1855531df7baab095ef608cda7240984340b.tar.bz2
passt-292c1855531df7baab095ef608cda7240984340b.tar.lz
passt-292c1855531df7baab095ef608cda7240984340b.tar.xz
passt-292c1855531df7baab095ef608cda7240984340b.tar.zst
passt-292c1855531df7baab095ef608cda7240984340b.zip
passt: Address new clang-tidy warnings from LLVM 13.0.1
clang-tidy from LLVM 13.0.1 reports some new warnings from these checkers: - altera-unroll-loops, altera-id-dependent-backward-branch: ignore for the moment being, add a TODO item - bugprone-easily-swappable-parameters: ignore, nothing to do about those - readability-function-cognitive-complexity: ignore for the moment being, add a TODO item - altera-struct-pack-align: ignore, alignment is forced in protocol headers - concurrency-mt-unsafe: ignore for the moment being, add a TODO item Fix bugprone-implicit-widening-of-multiplication-result warnings, though, that's doable and they seem to make sense. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tcp.c')
-rw-r--r--tcp.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/tcp.c b/tcp.c
index 7122898..723b18e 100644
--- a/tcp.c
+++ b/tcp.c
@@ -345,7 +345,7 @@
#define TCP_TAP_FRAMES 256
-#define MAX_PIPE_SIZE (2 * 1024 * 1024)
+#define MAX_PIPE_SIZE (2UL * 1024 * 1024)
#define TCP_HASH_TABLE_LOAD 70 /* % */
#define TCP_HASH_TABLE_SIZE (MAX_TAP_CONNS * 100 / \
@@ -1040,8 +1040,8 @@ static int tcp_opt_get(struct tcphdr *th, size_t len, uint8_t type_search,
uint8_t type, optlen;
char *p;
- if (len > (unsigned)th->doff * 4)
- len = th->doff * 4;
+ if (len > (size_t)th->doff * 4)
+ len = (size_t)th->doff * 4;
len -= sizeof(*th);
p = (char *)(th + 1);
@@ -1568,7 +1568,7 @@ static int tcp_update_seqack_wnd(struct ctx *c, struct tcp_tap_conn *conn,
#else
if (conn->state > ESTABLISHED || (flags & (DUP_ACK | FORCE_ACK)) ||
conn->local || tcp_rtt_dst_low(conn) ||
- conn->snd_buf < SNDBUF_SMALL) {
+ (unsigned long)conn->snd_buf < SNDBUF_SMALL) {
conn->seq_ack_to_tap = conn->seq_from_tap;
} else if (conn->seq_ack_to_tap != conn->seq_from_tap) {
if (!tinfo) {
@@ -2393,7 +2393,7 @@ static void tcp_data_from_tap(struct ctx *c, struct tcp_tap_conn *conn,
return;
}
- off = th->doff * 4;
+ off = (size_t)th->doff * 4;
if (off < sizeof(*th) || off > len) {
tcp_rst(c, conn);
return;