lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20201028133048.GA2406668@nvidia.com>
Date:   Wed, 28 Oct 2020 10:30:48 -0300
From:   Jason Gunthorpe <jgg@...dia.com>
To:     Arnd Bergmann <arnd@...nel.org>
CC:     Doug Ledford <dledford@...hat.com>,
        Shamir Rabinovitch <shamir.rabinovitch@...cle.com>,
        Arnd Bergmann <arnd@...db.de>,
        Leon Romanovsky <leon@...nel.org>,
        Yishai Hadas <yishaih@...lanox.com>,
        Michael Guralnik <michaelgur@...lanox.com>,
        "Gustavo A. R. Silva" <gustavoars@...nel.org>,
        <linux-rdma@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] IB/verbs: avoid nested container_of()

On Mon, Oct 26, 2020 at 05:15:39PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
> 
> Nested container_of() calls work correctly but cause a warning when
> building with W=2. Invoking it from an inline function like in
> drivers/infiniband/hw/mlx5/mlx5_ib.h means we get hundreds of
> warnings like:
> 
> include/linux/kernel.h:852:8: warning: declaration of '__mptr' shadows a previous local [-Wshadow]
>   852 |  void *__mptr = (void *)(ptr);     \
>       |        ^~~~~~
> include/rdma/uverbs_ioctl.h:651:11: note: in expansion of macro 'container_of'
>   651 |  (udata ? container_of(container_of(udata, struct uverbs_attr_bundle,   \
>       |           ^~~~~~~~~~~~
> include/rdma/uverbs_ioctl.h:651:24: note: in expansion of macro 'container_of'
>   651 |  (udata ? container_of(container_of(udata, struct uverbs_attr_bundle,   \
>       |                        ^~~~~~~~~~~~
> drivers/infiniband/hw/mthca/mthca_qp.c:564:35: note: in expansion of macro 'rdma_udata_to_drv_context'
>   564 |  struct mthca_ucontext *context = rdma_udata_to_drv_context(
>       |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/kernel.h:852:8: note: shadowed declaration is here
>   852 |  void *__mptr = (void *)(ptr);     \
>       |        ^~~~~~
> include/rdma/uverbs_ioctl.h:651:11: note: in expansion of macro 'container_of'
>   651 |  (udata ? container_of(container_of(udata, struct uverbs_attr_bundle,   \
>       |           ^~~~~~~~~~~~
> drivers/infiniband/hw/mthca/mthca_qp.c:564:35: note: in expansion of macro 'rdma_udata_to_drv_context'
>   564 |  struct mthca_ucontext *context = rdma_udata_to_drv_context(
>       |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from <command-line>:
> include/linux/kernel.h:852:8: warning: declaration of '__mptr' shadows a previous local [-Wshadow]
>   852 |  void *__mptr = (void *)(ptr);     \
>       |        ^~~~~~
> 
> Rewrite the macro to use an inline function internally, which makes
> it more readable and reduces the amount of useless output from
> make W=2.
> 
> Fixes: 730623f4a56f ("IB/verbs: Add helper function rdma_udata_to_drv_context")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
>  include/rdma/uverbs_ioctl.h | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)

Applied to rdma for-next, thanks

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ