@@ -149,7 +149,7 @@ int ibv_cmd_reg_dmabuf_mr(struct ibv_pd *pd, uint64_t offset, size_t length,
vmr->ibv_mr.lkey = lkey;
vmr->ibv_mr.rkey = rkey;
vmr->ibv_mr.pd = pd;
- vmr->ibv_mr.addr = (void *)offset;
+ vmr->ibv_mr.addr = (void *)(uintptr_t)offset;
vmr->ibv_mr.length = length;
vmr->mr_type = IBV_MR_TYPE_DMABUF_MR;
return 0;
@@ -384,7 +384,7 @@ struct ibv_mr *ibv_reg_dmabuf_mr(struct ibv_pd *pd, uint64_t offset,
mr->context = pd->context;
mr->pd = pd;
- mr->addr = (void *)offset;
+ mr->addr = (void *)(uintptr_t)offset;
mr->length = length;
return mr;
}
Commit 6b0a3238289f ("verbs: Support dma-buf based memory region") caused a build failure when building for 32b systems with gcc: $ mkdir build && cd build && CFLAGS="-m32" cmake -GNinja .. \ -DIOCTL_MODE=both -DNO_PYVERBS=1 -DENABLE_WERROR=1 && ninja ... ../libibverbs/cmd_mr.c: In function 'ibv_cmd_reg_dmabuf_mr': ../libibverbs/cmd_mr.c:152:21: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] vmr->ibv_mr.addr = (void *)offset; ... ../libibverbs/verbs.c: In function 'ibv_reg_dmabuf_mr': ../libibverbs/verbs.c:387:13: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] mr->addr = (void *)offset; ... Reported-by: Ali Alnubani <alialnu@nvidia.com> Signed-off-by: Jianxin Xiong <jianxin.xiong@intel.com> --- libibverbs/cmd_mr.c | 2 +- libibverbs/verbs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)