linux/drivers/infiniband/hw
Chen Linxuan 94bf4146af RDMA/hns: initialize db in update_srq_db()
[ Upstream commit ffe1cee21f ]

On x86_64 with gcc version 13.3.0, I compile
drivers/infiniband/hw/hns/hns_roce_hw_v2.c with:

  make defconfig
  ./scripts/kconfig/merge_config.sh .config <(
    echo CONFIG_COMPILE_TEST=y
    echo CONFIG_HNS3=m
    echo CONFIG_INFINIBAND=m
    echo CONFIG_INFINIBAND_HNS_HIP08=m
  )
  make KCFLAGS="-fno-inline-small-functions -fno-inline-functions-called-once" \
    drivers/infiniband/hw/hns/hns_roce_hw_v2.o

Then I get a compile error:

    CALL    scripts/checksyscalls.sh
    DESCEND objtool
    INSTALL libsubcmd_headers
    CC [M]  drivers/infiniband/hw/hns/hns_roce_hw_v2.o
  In file included from drivers/infiniband/hw/hns/hns_roce_hw_v2.c:47:
  drivers/infiniband/hw/hns/hns_roce_hw_v2.c: In function 'update_srq_db':
  drivers/infiniband/hw/hns/hns_roce_common.h:74:17: error: 'db' is used uninitialized [-Werror=uninitialized]
     74 |                 *((__le32 *)_ptr + (field_h) / 32) &=                          \
        |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  drivers/infiniband/hw/hns/hns_roce_common.h:90:17: note: in expansion of macro '_hr_reg_clear'
     90 |                 _hr_reg_clear(ptr, field_type, field_h, field_l);              \
        |                 ^~~~~~~~~~~~~
  drivers/infiniband/hw/hns/hns_roce_common.h:95:39: note: in expansion of macro '_hr_reg_write'
     95 | #define hr_reg_write(ptr, field, val) _hr_reg_write(ptr, field, val)
        |                                       ^~~~~~~~~~~~~
  drivers/infiniband/hw/hns/hns_roce_hw_v2.c:948:9: note: in expansion of macro 'hr_reg_write'
    948 |         hr_reg_write(&db, DB_TAG, srq->srqn);
        |         ^~~~~~~~~~~~
  drivers/infiniband/hw/hns/hns_roce_hw_v2.c:946:31: note: 'db' declared here
    946 |         struct hns_roce_v2_db db;
        |                               ^~
  cc1: all warnings being treated as errors

Signed-off-by: Chen Linxuan <chenlinxuan@uniontech.com>
Co-developed-by: Winston Wen <wentao@uniontech.com>
Signed-off-by: Winston Wen <wentao@uniontech.com>
Link: https://patch.msgid.link/FF922C77946229B6+20250411105459.90782-5-chenlinxuan@uniontech.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2025-06-27 11:11:34 +01:00
..
bnxt_re RDMA/bnxt_re: Avoid clearing VLAN_ID mask in modify qp path 2025-03-28 22:03:26 +01:00
cxgb4 RDMA/cxgb4: Notify rdma stack for IB_EVENT_QP_LAST_WQE_REACHED event 2025-02-08 09:57:51 +01:00
efa RDMA/efa: Reset device on probe failure 2025-02-21 14:01:22 +01:00
erdma RDMA/erdma: Prevent use-after-free in erdma_accept_newconn() 2025-04-10 14:39:19 +02:00
hfi1 [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
hns RDMA/hns: initialize db in update_srq_db() 2025-06-27 11:11:34 +01:00
irdma RDMA/irdma: Fix misspelling of "accept*" 2024-10-11 14:06:09 -03:00
mana RDMA/mana_ib: Ensure variable err is initialized 2025-04-10 14:39:18 +02:00
mlx4 RDMA/mlx4: Avoid false error about access to uninitialized gids array 2025-02-08 09:57:37 +01:00
mlx5 RDMA/mlx5: Fix error flow upon firmware failure for RQ destruction 2025-06-19 15:31:46 +02:00
mthca RDMA: Pass entire uverbs attr bundle to create cq function 2024-06-27 16:28:21 -03:00
ocrdma RDMA/ocrdma: Don't inline statistics functions 2024-07-11 13:25:11 +03:00
qedr RDMA: Pass entire uverbs attr bundle to create cq function 2024-06-27 16:28:21 -03:00
qib qibfs: fix _another_ leak 2025-05-02 07:59:20 +02:00
usnic RDMA/usnic: Fix passing zero to PTR_ERR in usnic_ib_pci_probe() 2025-04-25 10:47:39 +02:00
vmw_pvrdma RDMA: Pass entire uverbs attr bundle to create cq function 2024-06-27 16:28:21 -03:00
Makefile RDMA/hns: Clean up the legacy CONFIG_INFINIBAND_HNS 2025-02-08 09:57:46 +01:00