From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>, passt-dev@passt.top
Subject: Re: [PATCH v5 0/9] Add vhost-user support to passt (part 1)
Date: Wed, 6 Mar 2024 14:22:44 +1100 [thread overview]
Message-ID: <ZefhhKOtKczzQlLz@zatzit> (raw)
In-Reply-To: <20240305231218.149e80a1@elisabeth>
[-- Attachment #1: Type: text/plain, Size: 3383 bytes --]
On Tue, Mar 05, 2024 at 11:12:18PM +0100, Stefano Brivio wrote:
> On Sun, 3 Mar 2024 14:51:05 +0100
> Laurent Vivier <lvivier@redhat.com> wrote:
>
> > v5:
> > - add a patch to cleanup before change:
> > udp: little cleanup in udp_update_hdrX() to prepare future changes
> > - see detailed v5 history log in each patch
>
> I'm about to apply this, but cppcheck (2.10) tells me (with make
> cppcheck):
>
> checksum.c:195:33: style: inconclusive: Function 'csum_icmp4' argument 1 names different: declaration 'ih' definition 'icmp4hr'. [funcArgNamesDifferent]
> void csum_icmp4(struct icmphdr *icmp4hr, const void *payload, size_t len)
> ^
> checksum.h:23:33: note: Function 'csum_icmp4' argument 1 names different: declaration 'ih' definition 'icmp4hr'.
> void csum_icmp4(struct icmphdr *ih, const void *payload, size_t len);
> ^
> checksum.c:195:33: note: Function 'csum_icmp4' argument 1 names different: declaration 'ih' definition 'icmp4hr'.
> void csum_icmp4(struct icmphdr *icmp4hr, const void *payload, size_t len)
> ^
> pcap.c:145:47: style: inconclusive: Function 'pcap_iov' argument 2 names different: declaration 'n' definition 'iovcnt'. [funcArgNamesDifferent]
> void pcap_iov(const struct iovec *iov, size_t iovcnt)
> ^
> pcap.h:12:47: note: Function 'pcap_iov' argument 2 names different: declaration 'n' definition 'iovcnt'.
> void pcap_iov(const struct iovec *iov, size_t n);
> ^
> pcap.c:145:47: note: Function 'pcap_iov' argument 2 names different: declaration 'n' definition 'iovcnt'.
> void pcap_iov(const struct iovec *iov, size_t iovcnt)
> ^
> tcp.c:947:45: error: Expression 'tlen,IPPROTO_TCP,(struct in_addr){.s_addr=iph->saddr},(struct in_addr){.s_addr=iph->daddr}' depends on order of evaluation of side effects [unknownEvaluationOrder]
> (struct in_addr){ .s_addr = iph->saddr },
> ^
> checksum.c:506:0: style: The function 'csum_iov' is never used. [unusedFunction]
> uint16_t csum_iov(struct iovec *iov, size_t n, uint32_t init)
> ^
> pcap.c:145:0: style: The function 'pcap_iov' is never used. [unusedFunction]
> void pcap_iov(const struct iovec *iov, size_t iovcnt)
> ^
> iov.c:150:0: information: Unmatched suppression: unusedFunction [unmatchedSuppression]
> size_t iov_size(const struct iovec *iov, size_t iov_cnt)
> ^
>
> they are almost all trivial and I plan to fix them up on merge, but I
> still have to look into the initialisation in tcp_update_check_tcp4()
> (tcp.c:947:45).
I'm pretty sure this is a false positive from cppcheck: I think it's
misinterpreting this (initializer in struct literal) as an assignment
expression. Since there are then two apparent assignments to the same
apparent target, we have that warning.
The obvious workaround to me is to introduce a couple of struct
in_addr typed temporaries, instead of using struct literals. I think
that's kind of more readable anyway.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2024-03-06 3:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-03 13:51 [PATCH v5 0/9] Add vhost-user support to passt (part 1) Laurent Vivier
2024-03-03 13:51 ` [PATCH v5 1/9] pcap: add pcap_iov() Laurent Vivier
2024-03-03 13:51 ` [PATCH v5 2/9] checksum: align buffers Laurent Vivier
2024-03-03 13:51 ` [PATCH v5 3/9] checksum: add csum_iov() Laurent Vivier
2024-03-03 13:51 ` [PATCH v5 4/9] util: move IP stuff from util.[ch] to ip.[ch] Laurent Vivier
2024-03-03 13:51 ` [PATCH v5 5/9] udp: little cleanup in udp_update_hdrX() to prepare future changes Laurent Vivier
2024-03-04 0:46 ` David Gibson
2024-03-03 13:51 ` [PATCH v5 6/9] checksum: use csum_ip4_header() in udp.c and tcp.c Laurent Vivier
2024-03-03 13:51 ` [PATCH v5 7/9] checksum: introduce functions to compute the header part checksum for TCP/UDP Laurent Vivier
2024-03-04 0:52 ` David Gibson
2024-03-03 13:51 ` [PATCH v5 8/9] tap: make tap_update_mac() generic Laurent Vivier
2024-03-03 13:51 ` [PATCH v5 9/9] tcp: Introduce ipv4_fill_headers()/ipv6_fill_headers() Laurent Vivier
2024-03-04 0:54 ` David Gibson
2024-03-05 22:12 ` [PATCH v5 0/9] Add vhost-user support to passt (part 1) Stefano Brivio
2024-03-06 3:22 ` David Gibson [this message]
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=ZefhhKOtKczzQlLz@zatzit \
--to=david@gibson.dropbear.id.au \
--cc=lvivier@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).