From: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Yann Droneaud <ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>,
Sagi Grimberg
<sagig-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>,
Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Hal Rosenstock
<hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH] IB/core: avoid 32-bit warning
Date: Wed, 21 Oct 2015 16:58:01 -0400 [thread overview]
Message-ID: <5627FC59.4070502@redhat.com> (raw)
In-Reply-To: <1444225608.3188.67.camel-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1993 bytes --]
On 10/07/2015 09:46 AM, Yann Droneaud wrote:
> 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 <arnd-r2nGTMty4D4@public.gmane.org>
>>> 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.
>
I haven't seen this oether patch that Yann is talking about, so I've
taken this one.
--
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
GPG KeyID: 0E572FDD
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: dledford@redhat.com (Doug Ledford)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] IB/core: avoid 32-bit warning
Date: Wed, 21 Oct 2015 16:58:01 -0400 [thread overview]
Message-ID: <5627FC59.4070502@redhat.com> (raw)
In-Reply-To: <1444225608.3188.67.camel@opteya.com>
On 10/07/2015 09:46 AM, Yann Droneaud wrote:
> 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 <arnd@arndb.de>
>>> 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.
>
I haven't seen this oether patch that Yann is talking about, so I've
taken this one.
--
Doug Ledford <dledford@redhat.com>
GPG KeyID: 0E572FDD
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 884 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151021/71b41919/attachment-0001.sig>
WARNING: multiple messages have this Message-ID (diff)
From: Doug Ledford <dledford@redhat.com>
To: Yann Droneaud <ydroneaud@opteya.com>,
Sagi Grimberg <sagig@dev.mellanox.co.il>,
Arnd Bergmann <arnd@arndb.de>, Sean Hefty <sean.hefty@intel.com>,
Hal Rosenstock <hal.rosenstock@gmail.com>
Cc: Roland Dreier <roland@purestorage.com>,
linux-rdma@vger.kernel.org, Matan Barak <matanb@mellanox.com>,
Or Gerlitz <ogerlitz@mellanox.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] IB/core: avoid 32-bit warning
Date: Wed, 21 Oct 2015 16:58:01 -0400 [thread overview]
Message-ID: <5627FC59.4070502@redhat.com> (raw)
In-Reply-To: <1444225608.3188.67.camel@opteya.com>
[-- Attachment #1: Type: text/plain, Size: 1944 bytes --]
On 10/07/2015 09:46 AM, Yann Droneaud wrote:
> 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 <arnd@arndb.de>
>>> 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.
>
I haven't seen this oether patch that Yann is talking about, so I've
taken this one.
--
Doug Ledford <dledford@redhat.com>
GPG KeyID: 0E572FDD
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]
next prev parent reply other threads:[~2015-10-21 20:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-07 12:29 [PATCH] IB/core: avoid 32-bit warning Arnd Bergmann
2015-10-07 12:29 ` Arnd Bergmann
2015-10-07 12:29 ` Arnd Bergmann
2015-10-07 13:00 ` Yann Droneaud
2015-10-07 13:00 ` Yann Droneaud
2015-10-07 13:19 ` Sagi Grimberg
2015-10-07 13:19 ` Sagi Grimberg
2015-10-07 13:46 ` Arnd Bergmann
2015-10-07 13:46 ` Arnd Bergmann
2015-10-07 13:46 ` Yann Droneaud
2015-10-07 13:46 ` Yann Droneaud
[not found] ` <1444225608.3188.67.camel-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
2015-10-21 20:58 ` Doug Ledford [this message]
2015-10-21 20:58 ` Doug Ledford
2015-10-21 20:58 ` Doug Ledford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5627FC59.4070502@redhat.com \
--to=dledford-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=arnd-r2nGTMty4D4@public.gmane.org \
--cc=hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org \
--cc=sagig-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
--cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.