From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754880AbbJUU6G (ORCPT ); Wed, 21 Oct 2015 16:58:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35013 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750698AbbJUU6D (ORCPT ); Wed, 21 Oct 2015 16:58:03 -0400 Subject: Re: [PATCH] IB/core: avoid 32-bit warning To: Yann Droneaud , Sagi Grimberg , Arnd Bergmann , Sean Hefty , Hal Rosenstock References: <17269152.DqJfCm1LOx@wuerfel> <56151BDF.8010504@dev.mellanox.co.il> <1444225608.3188.67.camel@opteya.com> Cc: Roland Dreier , linux-rdma@vger.kernel.org, Matan Barak , Or Gerlitz , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org From: Doug Ledford Openpgp: id=AE6B1BDA122B23B4265B1274B826A3330E572FDD; url=pgp.mit.edu Organization: Red Hat, Inc. Message-ID: <5627FC59.4070502@redhat.com> Date: Wed, 21 Oct 2015 16:58:01 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1444225608.3188.67.camel@opteya.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="vGVh9UHWecC3Tjq3gNNeWCLX8fc9OTDVC" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --vGVh9UHWecC3Tjq3gNNeWCLX8fc9OTDVC Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/07/2015 09:46 AM, Yann Droneaud wrote: > Hi, >=20 > Le mercredi 07 octobre 2015 =C3=A0 16:19 +0300, Sagi Grimberg a =C3=A9c= rit : >> On 10/7/2015 3:29 PM, Arnd Bergmann wrote: >>> The INIT_UDATA() macro requires a pointer or unsigned long argument >>> for >>> both input and output buffer, and all callers had a cast from when >>> the code was merged until a recent restructuring, so now we get >>> >>> core/uverbs_cmd.c: In function 'ib_uverbs_create_cq': >>> core/uverbs_cmd.c:1481:66: warning: cast to pointer from integer of >>> different size [-Wint-to-pointer-cast] >>> >>> This makes the code behave as before by adding back the cast to >>> unsigned long. >>> >>> Signed-off-by: Arnd Bergmann >>> Fixes: 565197dd8fb1 ("IB/core: Extend ib_uverbs_create_cq") >>> >>> diff --git a/drivers/infiniband/core/uverbs_cmd.c >>> b/drivers/infiniband/core/uverbs_cmd.c >>> index be4cb9f04be3..88b3b78340f2 100644 >>> --- a/drivers/infiniband/core/uverbs_cmd.c >>> +++ b/drivers/infiniband/core/uverbs_cmd.c >>> @@ -1478,7 +1478,7 @@ ssize_t ib_uverbs_create_cq(struct >>> ib_uverbs_file *file, >>> if (copy_from_user(&cmd, buf, sizeof(cmd))) >>> return -EFAULT; >>> >>> - INIT_UDATA(&ucore, buf, cmd.response, sizeof(cmd), >>> sizeof(resp)); >>> + INIT_UDATA(&ucore, buf, (unsigned long)cmd.response, >>> sizeof(cmd), sizeof(resp)); >> >> Would it make sense to cast inside INIT_UDATA() and not have callers >> worry about it? >=20 > It's ... complicated. See INIT_UDATA_BUF_OR_NULL(). >=20 > Awayway, I have patch to do the opposite, eg. explicitly cast u64 value= > to (void __user *)(unsigned long) in the caller function instead, as it= > allows some safer / new operations on the response buffer. >=20 > Regards. >=20 I haven't seen this oether patch that Yann is talking about, so I've taken this one. --=20 Doug Ledford GPG KeyID: 0E572FDD --vGVh9UHWecC3Tjq3gNNeWCLX8fc9OTDVC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBCAAGBQJWJ/xZAAoJELgmozMOVy/dQncP/iXM8RulFr59PCia8vnLPSIs dj8p50TxrhJpSr2KXlXReTPq3VO61ZTV6AxFJWQqW/54H7piHhRu45GP+JeUWmbq mkVGIjHkI+BwElDxaoT0R6lhg/qsVvmbS2EhqWMY+B3cO65zl9EHyLxvu/hNhkA9 VYf/ZGvNGiyVBhLqw+TESNfHB1AInRDPhP11L/agAmPy+y7Ga6bt1599ogGHKo9j 6qiREBH0T7UIYgp/ghmsymiPbZ3FE5XtFVDYrhHyGWFtCWdmZIbLoI+DH8JKcSZS 1SfHhiYQhOICKp6RqtXKTmoigbb48E1uRKPLkOvlKH6SMWDW+wuMvbCwRnRfGgSB 7xo6Dy8/3MdpXkyyPQ19565U96x4lLuMYKrsZN+czb30w/3y62VC0DqODMQORRdR G/iDco4PUqo0uhPvjYXyxyDfI6Ae5836ePfOuDZuVmAZEbWdufRThyTNGuRg2lNG lDu9W78jaRsjVq2Zw66lbfbdG8C7s6f6N2nauCZp2n9Cwe3ls0wPvgZyfnTQlziD sMSqn76WT1YJI55gHcn6+YNthCbaef4ldsiOYr8nUp4/VM707dXYpWyTB97UtQ0g GWGVZ92HTGs6UEkUfOI/+pmxaJ9wOKb7oUBEQpPJjjs7+XuiK5LhWu4dvqzOl9nS gejwX1Pl1oC7/u+zZlxO =X26F -----END PGP SIGNATURE----- --vGVh9UHWecC3Tjq3gNNeWCLX8fc9OTDVC--