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 /dhcp.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 'dhcp.c')
-rw-r--r-- | dhcp.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -271,10 +271,10 @@ int dhcp(struct ctx *c, struct ethhdr *eh, size_t len) if (len < sizeof(*eh) + sizeof(*iph)) return 0; - if (len < sizeof(*eh) + iph->ihl * 4 + sizeof(*uh)) + if (len < sizeof(*eh) + (long)iph->ihl * 4 + sizeof(*uh)) return 0; - uh = (struct udphdr *)((char *)iph + iph->ihl * 4); + uh = (struct udphdr *)((char *)iph + (long)(iph->ihl * 4)); m = (struct msg *)(uh + 1); if (uh->dest != htons(67)) @@ -283,7 +283,7 @@ int dhcp(struct ctx *c, struct ethhdr *eh, size_t len) if (c->no_dhcp) return 1; - mlen = len - sizeof(*eh) - iph->ihl * 4 - sizeof(*uh); + mlen = len - sizeof(*eh) - (long)iph->ihl * 4 - sizeof(*uh); if (mlen != ntohs(uh->len) - sizeof(*uh) || mlen < offsetof(struct msg, o) || m->op != BOOTREQUEST) @@ -349,7 +349,7 @@ int dhcp(struct ctx *c, struct ethhdr *eh, size_t len) iph->daddr = c->addr4; iph->saddr = c->gw4; iph->check = 0; - iph->check = csum_unaligned(iph, iph->ihl * 4, 0); + iph->check = csum_unaligned(iph, (intptr_t)(iph->ihl * 4), 0); len += sizeof(*eh); memcpy(eh->h_dest, eh->h_source, ETH_ALEN); |