From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202410 header.b=Wtc1C0II; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 881045A004E for ; Thu, 31 Oct 2024 01:38:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202410; t=1730335068; bh=v3aNefb3cRs0O6RX18TUVzaemBQbZ394PeK1g52mh0w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Wtc1C0IImU9Li6EgyN2uJDwYJ8GRAnQ/LTzx9+kcIW2phpOUnlbSDdmfsGb8aGEn0 zTlFi7pTRw+UAIjagNIIKj4n3P3764crQpgIy/xT00U3mBfbsnAACVXnNmsbOcSyjf Pe4rPNKxNRsw5RoIJA0cd4T1hbtsn5SuZRYgXMaKzK3H0y3ZKPNgyHT1Qedi6eDcH9 H6lwq3aocRb/7cLRR3jZpe8SiXp0yy1F2IyNdocAXdat4flGeVPYtQ7eEZOLFZV9eM GLy+WnsyYv6FXlKk5NHAyFiOyav94LI9U5Q+LhFLlIZAYvdMjgd3Jz+1KmIKnCT7d9 hBEgLL9CmmITg== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Xf4pN3WwNz4xP0; Thu, 31 Oct 2024 11:37:48 +1100 (AEDT) Date: Thu, 31 Oct 2024 11:33:00 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH] tap: Explicitly cast TUNSETIFF to fix build warning with musl on ppc64le Message-ID: References: <20241030205030.325464-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="AianbzoZt890SizL" Content-Disposition: inline In-Reply-To: <20241030205030.325464-1-sbrivio@redhat.com> Message-ID-Hash: H6QFMFLQKTQ3EJ736LJGRIUTBD4LLLNN X-Message-ID-Hash: H6QFMFLQKTQ3EJ736LJGRIUTBD4LLLNN 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, omni 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: --AianbzoZt890SizL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Oct 30, 2024 at 09:50:30PM +0100, Stefano Brivio wrote: > On ppc64le, TUNSETIFF happens to be 2147767498, which is bigger than > INT_MAX (2^31 - 1), and musl declares the second argument of ioctl() > as 'int', not 'unsigned long' like glibc does, probably because of how > POSIX specifies the equivalent argument, int dcmd, in posix_devctl(), > so gcc reports a warning: >=20 > tap.c: In function 'tap_ns_tun': > tap.c:1291:24: warning: overflow in conversion from 'long unsigned int' t= o 'int' changes value from '2147767498' to '-2147199798' [-Woverflow] > 1291 | rc =3D ioctl(fd, TUNSETIFF, &ifr); > | ^~~~~~~~~ >=20 > We don't care about that overflow, so explicitly cast TUNSETIFF to > int. >=20 > Signed-off-by: Stefano Brivio Ugly, but I don't see a better way to deal with it. Reviewed-by: David Gibson > --- > tap.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/tap.c b/tap.c > index cfb82e9..f638f2c 100644 > --- a/tap.c > +++ b/tap.c > @@ -1288,7 +1288,7 @@ static int tap_ns_tun(void *arg) > if (fd < 0) > die_perror("Failed to open() /dev/net/tun"); > =20 > - rc =3D ioctl(fd, TUNSETIFF, &ifr); > + rc =3D ioctl(fd, (int)TUNSETIFF, &ifr); > if (rc < 0) > die_perror("TUNSETIFF ioctl on /dev/net/tun failed"); > =20 --=20 David Gibson (he or they) | 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 --AianbzoZt890SizL Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmci0DcACgkQzQJF27ox 2GfEpw//a+11MV+ZKLglN2Ez3GhSypgr9Gl2nhKaQBtM/HVxqfiw/W0yKq028CC5 GCy9+yMC6cdJkhHKuy46XxfluJ+61KtzncJIgK/nk6bc3DgK9AEPmpXD09RaXPxd 9K0o1LOfEtV7XUL/SD1YG6GXYDfQo3hBN6Amr7yYGW/0QV4xAfEiWSBZVQTpFOqb S56T3NfToDw6owEG/fHWWkiv9Jbdfn/APJC2Fv35R2QcYx5ZFL3bXCEGyLQagh0d J7U/qvfkXxsv2ZFCzmpCTH3KpRWhxmUzzLIdaNeq3TFOj/nGDxU+jdU67XbECyE7 CHJ6FDvaD/dxK1Kw+vuO65YyQeU2nSgS0r6bP32XPkFZAjcNkhoonG8cdTnB5rEq GpkwmHK8yRug7LPj+A6hoBUWGOyDceuKjwcbPCXUBxBp5tQ2ez3K893fOEn7WkF2 86XEovXuGR9MjN9BGdgQVztd6rD0AOhf9UadNqvdqwCvstCG+K6HGpL77d4AeCS+ iTMTMf4T1UJUseSHjavFuzzIGoGLhni4kgZLmSrWtfQKiEMl+0xIN2VK675icLy7 cS+wMSM6isihAQlVP7ZQ62HviBg4yGHy8JSR82uJpr980q1qfPJhDIjZhDXoUgCI LGlohENvKtQpYLUrYeIjITHnvnEqyFLTR5tceW2PFvtVgpCagzI= =GD4L -----END PGP SIGNATURE----- --AianbzoZt890SizL--