Skip to content

Commit be286f8

Browse files
elic307imstsirkin
authored andcommitted
vdpa/mlx5: Set err = -ENOMEM in case dma_map_sg_attrs fails
Set err = -ENOMEM if dma_map_sg_attrs() fails so the function reutrns error. Fixes: 94abbcc ("vdpa/mlx5: Add shared memory registration code") Signed-off-by: Eli Cohen <elic@nvidia.com> Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20210411083646.910546-1-elic@nvidia.com Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
1 parent a9d0645 commit be286f8

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • drivers/vdpa/mlx5/core

drivers/vdpa/mlx5/core/mr.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,10 @@ static int map_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr
278278
mr->log_size = log_entity_size;
279279
mr->nsg = nsg;
280280
mr->nent = dma_map_sg_attrs(dma, mr->sg_head.sgl, mr->nsg, DMA_BIDIRECTIONAL, 0);
281-
if (!mr->nent)
281+
if (!mr->nent) {
282+
err = -ENOMEM;
282283
goto err_map;
284+
}
283285

284286
err = create_direct_mr(mvdev, mr);
285287
if (err)

0 commit comments

Comments
 (0)