Skip to content

Commit dd29f7c

Browse files
changchengxrleon
authored andcommitted
verbs: fix build warning with set uninitialized data
Fix below build warning $ EXTRA_CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=Debug -DMLX5_DEBUG=TRUE" ./build.sh || In file included from ../libibverbs/verbs.c:50: || ../libibverbs/verbs.c: In function ‘ibv_create_comp_channel’: || include/infiniband/cmd_write.h:157:48: warning: ‘resp’ may be used uninitialized [-Wmaybe-uninitialized] || 157 | (cmd)->core_payload.response = ioctl_ptr_to_u64(resp); \ || | ^~~~~~~~~~~~~~~~~~~~~~ || ../libibverbs/verbs.c:509:13: note: in expansion of macro ‘execute_cmd_write’ || 509 | if (execute_cmd_write(context, IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL, || | ^~~~~~~~~~~~~~~~~ || In file included from include/infiniband/cmd_write.h:36, || from ../libibverbs/verbs.c:50: || include/infiniband/cmd_ioctl.h:45:24: note: by argument 1 of type ‘const void *’ to ‘ioctl_ptr_to_u64’ declared here || 45 | static inline uint64_t ioctl_ptr_to_u64(const void *ptr) || | ^~~~~~~~~~~~~~~~ || ../libibverbs/verbs.c:501:51: note: ‘resp’ declared here || 501 | struct ib_uverbs_create_comp_channel_resp resp; || | ^~~~ Signed-off-by: Liu, Changcheng <changcheng.liu@aliyun.com> Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent 01a4380 commit dd29f7c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libibverbs/verbs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ LATEST_SYMVER_FUNC(ibv_dereg_mr, 1_1, "IBVERBS_1.1",
498498
struct ibv_comp_channel *ibv_create_comp_channel(struct ibv_context *context)
499499
{
500500
struct ibv_create_comp_channel req;
501-
struct ib_uverbs_create_comp_channel_resp resp;
501+
struct ib_uverbs_create_comp_channel_resp resp = {};
502502
struct ibv_comp_channel *channel;
503503

504504
channel = malloc(sizeof *channel);

0 commit comments

Comments
 (0)