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>
This commit is contained in:
@@ -108,10 +108,13 @@ uint16_t csum_unaligned(const void *buf, size_t len, uint32_t init)
|
||||
*/
|
||||
void csum_tcp4(struct iphdr *iph)
|
||||
{
|
||||
struct tcphdr *th = (struct tcphdr *)((char *)iph + iph->ihl * 4);
|
||||
uint16_t tlen = ntohs(iph->tot_len) - iph->ihl * 4, *p = (uint16_t *)th;
|
||||
uint16_t tlen = ntohs(iph->tot_len) - iph->ihl * 4, *p;
|
||||
struct tcphdr *th;
|
||||
uint32_t sum = 0;
|
||||
|
||||
th = (struct tcphdr *)((char *)iph + (intptr_t)(iph->ihl * 4));
|
||||
p = (uint16_t *)th;
|
||||
|
||||
sum += (iph->saddr >> 16) & 0xffff;
|
||||
sum += iph->saddr & 0xffff;
|
||||
sum += (iph->daddr >> 16) & 0xffff;
|
||||
|
Reference in New Issue
Block a user