linux/drivers/infiniband/hw
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
..
bnxt_re Updates for 4.15 kernel merge window 2017-11-15 14:54:53 -08:00
cxgb3 Updates for 4.15 kernel merge window 2017-11-15 14:54:53 -08:00
cxgb4 iw_cxgb4: atomically flush the qp 2017-11-13 16:59:22 -05:00
hfi1 IB/hfi1: Use 4096 for default active MTU in query_qp 2017-12-11 16:19:40 -07:00
hns RDMA/hns: Modify the usage of cmd_sn in hip08 2017-11-10 12:32:43 -05:00
i40iw i40iw: Reinitialize add_sd_cnt 2017-12-11 16:19:44 -07:00
mlx4 IB/mlx4: Add CQ moderation capability to query_device 2017-11-13 16:59:22 -05:00
mlx5 IB/mlx5: revisit -Wmaybe-uninitialized warning 2017-12-11 16:19:44 -07:00
mthca treewide: setup_timer() -> timer_setup() (2 field) 2017-11-21 15:57:09 -08:00
nes nes: remove unused 'timeval' struct member 2017-12-11 16:19:42 -07:00
ocrdma IB/ocrdma_hw: remove unnecessary code in ocrdma_mbx_dealloc_lkey 2017-11-13 16:18:33 -05:00
qedr Updates for 4.15 kernel merge window 2017-11-15 14:54:53 -08:00
qib IB/qib: Cleanup qib_set_part_key() with direct returns 2017-12-11 16:19:41 -07:00
usnic Updates for 4.15 kernel merge window 2017-11-15 14:54:53 -08:00
vmw_pvrdma RDMA/vmw_pvrdma: Do not re-calculate npages 2017-12-11 16:19:42 -07:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00