linux/drivers/infiniband/hw/mlx5
Arnd Bergmann 1b19b95169 IB/mlx5: revisit -Wmaybe-uninitialized warning
A warning that I thought I had fixed before occasionally comes
back in rare randconfig builds (I found 7 instances in the last
100000 builds, originally it was much more frequent):

drivers/infiniband/hw/mlx5/mr.c: In function 'mlx5_ib_reg_user_mr':
drivers/infiniband/hw/mlx5/mr.c:1229:5: error: 'order' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  if (order <= mr_cache_max_order(dev)) {
     ^
drivers/infiniband/hw/mlx5/mr.c:1247:8: error: 'ncont' may be used uninitialized in this function [-Werror=maybe-uninitialized]
drivers/infiniband/hw/mlx5/mr.c:1247:8: error: 'page_shift' may be used uninitialized in this function [-Werror=maybe-uninitialized]
drivers/infiniband/hw/mlx5/mr.c:1260:2: error: 'npages' may be used uninitialized in this function [-Werror=maybe-uninitialized]

I've looked at all those findings again and noticed that they are all
with CONFIG_INFINIBAND_USER_MEM=n, which means ib_umem_get() returns
an error unconditionally and we never initialize or use those variables.
This triggers a condition in gcc iff mr_umem_get() is partially but not
entirely inlined, which in turn depends on the exact combination of
optimization settings. This is a known problem with gcc, with no
easy solution in the compiler, so this adds another workaround that
should be more reliable than my previous attempt.

Returning an error from mlx5_ib_reg_user_mr() earlier means that we
can completely bypass the logic that caused the warning, the compiler
can now see that the variable is never accessed.

Fixes: 14ab8896f5 ("IB/mlx5: avoid bogus -Wmaybe-uninitialized warning")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
2017-12-11 16:19:44 -07:00
..
ah.c IB: Let ib_core resolve destination mac address 2017-10-18 12:10:36 -04:00
cmd.c IB/mlx5: Add debug control parameters for congestion control 2017-07-24 10:34:28 -04:00
cmd.h IB/mlx5: Add debug control parameters for congestion control 2017-07-24 10:34:28 -04:00
cong.c IB/mlx5: Add debug control parameters for congestion control 2017-07-24 10:34:28 -04:00
cq.c IB/mlx5: Exposing modify CQ callback to uverbs layer 2017-11-13 16:59:22 -05:00
doorbell.c IB/mlx5: Fix Mellanox copyright note 2015-04-02 16:33:42 -04:00
gsi.c IB/mlx5: Fix iteration overrun in GSI qps 2016-08-02 14:32:51 -04:00
ib_virt.c IB/mlx5: Restore IB guid/policy for virtual functions 2017-07-24 10:34:28 -04:00
Kconfig net/mlx5: Extend mlx5_core to support ConnectX-4 Ethernet functionality 2015-05-30 18:24:51 -07:00
mad.c IB/mlx5: Fix some spelling mistakes 2017-08-24 16:27:11 -04:00
main.c IB/mlx5: Add CQ moderation capability to query_device 2017-11-13 16:59:22 -05:00
Makefile IB/mlx5: Add debug control parameters for congestion control 2017-07-24 10:34:28 -04:00
mem.c IB/mlx5: Simplify mlx5_ib_cont_pages 2017-09-25 11:47:24 -04:00
mlx5_ib.h IB/mlx5: Add PCI write end padding support 2017-11-10 13:50:27 -05:00
mr.c IB/mlx5: revisit -Wmaybe-uninitialized warning 2017-12-11 16:19:44 -07:00
odp.c IB/mlx5: Use ARRAY_SIZE 2017-10-18 12:16:14 -04:00
qp.c IB/mlx5: Fix RoCE Address Path fields 2017-11-13 13:53:22 -05:00
srq.c IB/mlx5: Support IB_SRQT_TM 2017-08-29 08:30:20 -04:00