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 A16475A021E for ; Wed, 1 Mar 2023 06:17:50 +0100 (CET) Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4PRMtz70myz4xDl; Wed, 1 Mar 2023 16:17:47 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1677647867; bh=8wlD/ufcCTln5O6HE4c5j4zjBl0UQvsTUQbhzie4tqc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ilBTf174DgL2jzr+BEfJivYEy+m+yi6G2SGDViuS07cgLxwdGb+e3K9FRAX9+e54s pAJJJHuFwrsF4DBFzZP96F27EIyVMXxfEpd3CRf7iCRuuiA9rwOt76W3eCr3kaMUxf fxsmrgZ/9wwy0YQA6zmc+k/Mj/BLTBKU15RunnMY= Date: Wed, 1 Mar 2023 14:26:32 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH] udp: Fix signedness warning on 32-bits architectures Message-ID: References: <20230228101751.1605597-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="CGVZNgepu/WdqnX1" Content-Disposition: inline In-Reply-To: <20230228101751.1605597-1-sbrivio@redhat.com> Message-ID-Hash: Q752T6LKAOHJTZ5SGD4EP5IB2KUUN2N5 X-Message-ID-Hash: Q752T6LKAOHJTZ5SGD4EP5IB2KUUN2N5 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 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: --CGVZNgepu/WdqnX1 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 28, 2023 at 11:17:51AM +0100, Stefano Brivio wrote: 11;rgb:ffff/ffff/ffff> When a ssize_t is an int: >=20 > udp.c: In function =E2=80=98udp_sock_handler=E2=80=99: > udp.c:774:23: warning: comparison of integer expressions of different sig= nedness: =E2=80=98unsigned int=E2=80=99 and =E2=80=98ssize_t=E2=80=99 {aka = =E2=80=98int=E2=80=99} [-Wsign-compare] > 774 | for (i =3D 0; i < n; i +=3D m) { > | ^ > udp.c:781:43: warning: comparison of integer expressions of different sig= nedness: =E2=80=98unsigned int=E2=80=99 and =E2=80=98ssize_t=E2=80=99 {aka = =E2=80=98int=E2=80=99} [-Wsign-compare] > 781 | for (m =3D 1; i + m < n; m++) { > | >=20 > Change 'i' and 'm' counters in udp_sock_handler() to signed versions, > to match ssize_t n. >=20 > Signed-off-by: Stefano Brivio Reviewed-by: David Gibson > --- > udp.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/udp.c b/udp.c > index 20a9ea0..b7cbfdc 100644 > --- a/udp.c > +++ b/udp.c > @@ -754,7 +754,7 @@ void udp_sock_handler(struct ctx *c, union epoll_ref = ref, uint32_t events, > in_port_t dstport =3D ref.r.p.udp.udp.port; > bool v6 =3D ref.r.p.udp.udp.v6; > struct mmsghdr *mmh_recv; > - unsigned int i, m; > + int i, m; > =20 > if (!(events & EPOLLIN)) > return; --=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 --CGVZNgepu/WdqnX1 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmP+xeEACgkQzQJF27ox 2Gd79Q/9FahVjwY8ZtgdUVlvb1ykNOGu5SK1lLLwe7+gUihi5VowdTBYb7g6IRxj mRwROPM3CiRP7g/Km2jjlpUL9rz3zqfwWt1Fh1KeD/9+tine1B1lnQeUMv5YpmHA /egywJFAwQwjXTCi9hfJpEiGm1yECagAluMbtuWgufrT1c+AQbxl83ZTKfEq2Gp7 RfA5O5ocRy36ugrEfMzrK4vw4hkfSKdQS7hsio45NGIJTxx/uiNSOUu2nBZkRRZK ezX4Dro33yKQ4GWO4H3b9+qpfu37qHXaDFiGbqCvgIkYOtqZR6jhZCzafn9f+1YE tSZ2Q7GJlrnOcDtjTixUrGtOWjN/2RyeIKjBpQXrDEE/abFulZNhRIlMePdbvqE4 Ai0n8fbzSs1+y0RYIhGdlS4Z2J3B6Cr0YkPCXFDzVKXCOaYXgAPGfgVZT/y84mD5 fsKWpDhRr2rwvz/7BKShP6p4j7DUzBExrusMjLgqzO8ADBJX+K1exgIGZMyltTw7 TWcIrFZLadFhBvW19eQP5MQwR6qJRDHFE6mokBUypJlUpcc5sAvTStK7Ob3HXAWy qpHVB1MMOdZZevit/7DX0J5eqRgsmgBku9vinpofCLbNDozNF96OU8YNns1yykxK 8gFM1dzgZJ9dWuRGQOFBJUQqR1MV/OyZOhvfA3Lz9Dwfc3N9GtI= =b8hc -----END PGP SIGNATURE----- --CGVZNgepu/WdqnX1--