* [PATCH] IB/core: avoid 32-bit warning
@ 2015-10-07 12:29 Arnd Bergmann
2015-10-07 13:00 ` Yann Droneaud
2015-10-07 13:19 ` Sagi Grimberg
0 siblings, 2 replies; 6+ messages in thread
From: Arnd Bergmann @ 2015-10-07 12:29 UTC (permalink / raw)
To: Doug Ledford, Sean Hefty, Hal Rosenstock
Cc: Roland Dreier, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Matan Barak,
Or Gerlitz, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
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));
INIT_UDATA(&uhw, buf + sizeof(cmd),
(unsigned long)cmd.response + sizeof(resp),
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] IB/core: avoid 32-bit warning
2015-10-07 12:29 [PATCH] IB/core: avoid 32-bit warning Arnd Bergmann
@ 2015-10-07 13:00 ` Yann Droneaud
2015-10-07 13:19 ` Sagi Grimberg
1 sibling, 0 replies; 6+ messages in thread
From: Yann Droneaud @ 2015-10-07 13:00 UTC (permalink / raw)
To: Arnd Bergmann, Doug Ledford, Sean Hefty, Hal Rosenstock
Cc: Roland Dreier, linux-rdma, Matan Barak, Or Gerlitz, linux-kernel,
linux-arm-kernel
Hi,
Le mercredi 07 octobre 2015 à 14:29 +0200, Arnd Bergmann a écrit :
> 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")
>
Reviewed-by: Yann Droneaud <ydroneaud@opteya.com>
> 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));
>
> INIT_UDATA(&uhw, buf + sizeof(cmd),
> (unsigned long)cmd.response + sizeof(resp),
>
Regards.
--
Yann Droneaud
OPTEYA
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] IB/core: avoid 32-bit warning
2015-10-07 12:29 [PATCH] IB/core: avoid 32-bit warning Arnd Bergmann
2015-10-07 13:00 ` Yann Droneaud
@ 2015-10-07 13:19 ` Sagi Grimberg
2015-10-07 13:46 ` Arnd Bergmann
2015-10-07 13:46 ` Yann Droneaud
1 sibling, 2 replies; 6+ messages in thread
From: Sagi Grimberg @ 2015-10-07 13:19 UTC (permalink / raw)
To: Arnd Bergmann, Doug Ledford, Sean Hefty, Hal Rosenstock
Cc: Roland Dreier, linux-rdma, Matan Barak, Or Gerlitz, linux-kernel,
linux-arm-kernel
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?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] IB/core: avoid 32-bit warning
2015-10-07 13:19 ` Sagi Grimberg
@ 2015-10-07 13:46 ` Arnd Bergmann
2015-10-07 13:46 ` Yann Droneaud
1 sibling, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2015-10-07 13:46 UTC (permalink / raw)
To: Sagi Grimberg
Cc: Doug Ledford, Sean Hefty, Hal Rosenstock, Roland Dreier,
linux-rdma, Matan Barak, Or Gerlitz, linux-kernel,
linux-arm-kernel
On Wednesday 07 October 2015 16:19:27 Sagi Grimberg wrote:
> 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?
If we want to do this properly, INIT_UDATA should be converted into a function
call that has the right types.
My patch doesn't try to do that here, it just restores the code to how it
was for the past 10 years.
Arnd
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] IB/core: avoid 32-bit warning
2015-10-07 13:19 ` Sagi Grimberg
2015-10-07 13:46 ` Arnd Bergmann
@ 2015-10-07 13:46 ` Yann Droneaud
[not found] ` <1444225608.3188.67.camel-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
1 sibling, 1 reply; 6+ messages in thread
From: Yann Droneaud @ 2015-10-07 13:46 UTC (permalink / raw)
To: Sagi Grimberg, Arnd Bergmann, Doug Ledford, Sean Hefty,
Hal Rosenstock
Cc: Roland Dreier, linux-rdma, Matan Barak, Or Gerlitz, linux-kernel,
linux-arm-kernel
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.
--
Yann Droneaud
OPTEYA
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] IB/core: avoid 32-bit warning
[not found] ` <1444225608.3188.67.camel-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
@ 2015-10-21 20:58 ` Doug Ledford
0 siblings, 0 replies; 6+ messages in thread
From: Doug Ledford @ 2015-10-21 20:58 UTC (permalink / raw)
To: Yann Droneaud, Sagi Grimberg, Arnd Bergmann, Sean Hefty,
Hal Rosenstock
Cc: Roland Dreier, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Matan Barak,
Or Gerlitz, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
[-- 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 --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-10-21 20:58 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-07 12:29 [PATCH] IB/core: avoid 32-bit warning Arnd Bergmann
2015-10-07 13:00 ` Yann Droneaud
2015-10-07 13:19 ` Sagi Grimberg
2015-10-07 13:46 ` Arnd Bergmann
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).