From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: passt-dev@passt.top, lemmi@nerd2nerd.org
Subject: Re: [PATCH v2 2/3] packet: Offset plus length is not always uint32_t, but it's always size_t
Date: Fri, 1 Dec 2023 11:02:34 +1100 [thread overview]
Message-ID: <ZWkimjEmOCQtqcsy@zatzit> (raw)
In-Reply-To: <20231130100726.4151850-3-sbrivio@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1321 bytes --]
On Thu, Nov 30, 2023 at 11:07:25AM +0100, Stefano Brivio wrote:
> According to gcc, PRIu32 matches the type of the argument we're
> printing here on both 64 and 32-bits architectures. According to
> Clang, though, that's not the case, as the result of the sum is an
> unsigned long on 64-bit.
>
> Use the z modifier, given that we're summing uint32_t to size_t, and
> the result is at most promoted to size_t.
>
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> packet.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/packet.c b/packet.c
> index 12ac76b..ccfc846 100644
> --- a/packet.c
> +++ b/packet.c
> @@ -106,7 +106,7 @@ void *packet_get_do(const struct pool *p, size_t idx, size_t offset,
>
> if (p->pkt[idx].offset + len + offset > p->buf_size) {
> if (func) {
> - trace("packet offset plus length %lu from size %zu, "
> + trace("packet offset plus length %zu from size %zu, "
> "%s:%i", p->pkt[idx].offset + len + offset,
> p->buf_size, func, line);
> }
--
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 --]
next prev parent reply other threads:[~2023-12-01 0:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-30 10:07 [PATCH v2 0/3] Fix some build warnings and errors for 32-bit and musl Stefano Brivio
2023-11-30 10:07 ` [PATCH v2 1/3] treewide: Use 'z' length modifier for size_t/ssize_t conversions Stefano Brivio
2023-12-01 0:01 ` David Gibson
2023-11-30 10:07 ` [PATCH v2 2/3] packet: Offset plus length is not always uint32_t, but it's always size_t Stefano Brivio
2023-12-01 0:02 ` David Gibson [this message]
2023-11-30 10:07 ` [PATCH v2 3/3] port_fwd, util: Include additional headers to fix build with musl Stefano Brivio
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=ZWkimjEmOCQtqcsy@zatzit \
--to=david@gibson.dropbear.id.au \
--cc=lemmi@nerd2nerd.org \
--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).