diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2022-01-30 02:59:12 +0100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-01-30 02:59:12 +0100 |
commit | 292c1855531df7baab095ef608cda7240984340b (patch) | |
tree | dd5bc98e5b9beaf7721c87542fe37485dd712f37 /tap.c | |
parent | 20d271b22604fc11a0b75fee52b89a6654c67db6 (diff) | |
download | passt-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 'tap.c')
-rw-r--r-- | tap.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -131,7 +131,7 @@ void tap_ip_send(struct ctx *c, struct in6_addr *src, uint8_t proto, memcpy(&iph->saddr, &src->s6_addr[12], 4); iph->check = 0; - iph->check = csum_unaligned(iph, iph->ihl * 4, 0); + iph->check = csum_unaligned(iph, (size_t)iph->ihl * 4, 0); memcpy(data, in, len); @@ -337,9 +337,9 @@ resume: continue; iph = (struct iphdr *)(eh + 1); - if ((iph->ihl * 4) + sizeof(*eh) > len) + if ((size_t)iph->ihl * 4 + sizeof(*eh) > len) continue; - if (iph->ihl * 4 < (int)sizeof(*iph)) + if ((size_t)iph->ihl * 4 < (int)sizeof(*iph)) continue; if (iph->saddr && c->addr4_seen != iph->saddr) { @@ -347,7 +347,7 @@ resume: proto_update_l2_buf(NULL, NULL, &c->addr4_seen); } - l4h = (char *)iph + iph->ihl * 4; + l4h = (char *)iph + (size_t)iph->ihl * 4; l4_len = len - ((intptr_t)l4h - (intptr_t)eh); if (iph->protocol == IPPROTO_ICMP) { |