From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754331AbbJGNrJ (ORCPT ); Wed, 7 Oct 2015 09:47:09 -0400 Received: from ou.quest-ce.net ([195.154.187.82]:43090 "EHLO ou.quest-ce.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754305AbbJGNrF (ORCPT ); Wed, 7 Oct 2015 09:47:05 -0400 Message-ID: <1444225608.3188.67.camel@opteya.com> From: Yann Droneaud To: Sagi Grimberg , Arnd Bergmann , Doug Ledford , Sean Hefty , Hal Rosenstock Cc: Roland Dreier , linux-rdma@vger.kernel.org, Matan Barak , Or Gerlitz , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Date: Wed, 07 Oct 2015 15:46:48 +0200 In-Reply-To: <56151BDF.8010504@dev.mellanox.co.il> References: <17269152.DqJfCm1LOx@wuerfel> <56151BDF.8010504@dev.mellanox.co.il> Organization: OPTEYA Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.16.5 (3.16.5-3.fc22) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 77.154.202.32 X-SA-Exim-Mail-From: ydroneaud@opteya.com Subject: Re: [PATCH] IB/core: avoid 32-bit warning X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on ou.quest-ce.net) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Le mercredi 07 octobre 2015 à 16:19 +0300, Sagi Grimberg a écrit : > 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? It's ... complicated. See INIT_UDATA_BUF_OR_NULL(). 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. Regards. -- Yann Droneaud OPTEYA