From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id DDE035A0280 for ; Fri, 1 Dec 2023 01:02:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1701388964; bh=EE7XbRwqXdRd2AiYJSba7rdOgmoFRqy5AUsoXKPKBbc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YJkfvurtctPBwdEJwHuLvR2C6LYlin0jNSEWzHrtnscCXceK+eH5vYIIHaR0sUJWm 54X1T/84J/TZKzwllarM49e98DxOZm0JoCzTJNTSC3JpnQrnlKEz0EixrSCqrf84aO zxZpj4bsGpz7UuPomRlKxUHBal709dxHVjRgGKd4= Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4ShCtX1McXz4wx7; Fri, 1 Dec 2023 11:02:44 +1100 (AEDT) Date: Fri, 1 Dec 2023 11:02:34 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH v2 2/3] packet: Offset plus length is not always uint32_t, but it's always size_t Message-ID: References: <20231130100726.4151850-1-sbrivio@redhat.com> <20231130100726.4151850-3-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="iEzins/Y2Iemi0gs" Content-Disposition: inline In-Reply-To: <20231130100726.4151850-3-sbrivio@redhat.com> Message-ID-Hash: SIOSJJOJBBTPDAURTHQTAROGOT72ERJU X-Message-ID-Hash: SIOSJJOJBBTPDAURTHQTAROGOT72ERJU X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top, lemmi@nerd2nerd.org X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --iEzins/Y2Iemi0gs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. >=20 > Use the z modifier, given that we're summing uint32_t to size_t, and > the result is at most promoted to size_t. >=20 > Signed-off-by: Stefano Brivio Reviewed-by: David Gibson > --- > packet.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > 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, > =20 > 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); > } --=20 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 --iEzins/Y2Iemi0gs Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmVpIpkACgkQzQJF27ox 2GdXTRAAqg+Ja+qDkRwO9+R4LZbqq2qY4BpaXkACaY6SAOq7SluczkTS+EDLJnY/ rCAg+mCoWJB/yF5+nQBoRVe90mJfWFkBlqMjJYQ0TlPU8wFf9YE2fNsJIAqfOU7K r0rwmabCvVl9jxRBYG1OkLI5hJOIsWP8CaD+fw/lZkDzY6pJQ5ulOCh/2MVqv64D h8Ec+WHoomRHo8Gs4mHvELFYSlqzqi6fr//UDZbzMbzbUjj0n3BrsBny17/AK5YH w5BVBtTdD5Ei3NmM21AGeO46ELHHIYWhdypeBxxokxSjQcwe+uWBjkGubpBmrnP1 pXIhCq66/6MXypcjjzc3mxKQtkUkPFvbEPa/Ie57bv6QH54ACJ8TN2AGvz+Gkj9M v6jyVCaMG5Wsbxtmzsmv1g6ZnKEZvEnnQzdhLFZJq+YSIo+4hFXk4uh1qBiHEcUF w2JcwJebnupOJjX1oWu/hifbuw54u+Z5bS537mWn3AWPJKQ0Ogu9QZmztSIR2t7v KFxiG8wTPDK5B4qD7UfeUemxnnw5i2YquffdejbN7aaCZuezjxsxyjDW0Ou80arX MWFoEh9Yta+5lUxMmtMn7kbMVfa0iQbTEIRa8eTCvOtS2jRwTxzGC+8Z78S6jDN4 YQ61O8DkHkZ5nbVEG2MTYECmGr4diM9c+AYCRE/SXrYFBZBx/R8= =65r3 -----END PGP SIGNATURE----- --iEzins/Y2Iemi0gs--