netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vdpa/mlx5: Set err = -ENOMEM in case dma_map_sg_attrs fails
@ 2021-04-11  8:36 Eli Cohen
  2021-04-12  9:45 ` Jason Wang
  2021-04-12 12:49 ` Stefano Garzarella
  0 siblings, 2 replies; 3+ messages in thread
From: Eli Cohen @ 2021-04-11  8:36 UTC (permalink / raw)
  To: mst, jasowang, si-wei.liu, virtualization, netdev
  Cc: elic, kernel test robot, Dan Carpenter

Set err = -ENOMEM if dma_map_sg_attrs() fails so the function reutrns
error.

Fixes: 94abbccdf291 ("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>
---
 drivers/vdpa/mlx5/core/mr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/vdpa/mlx5/core/mr.c b/drivers/vdpa/mlx5/core/mr.c
index 3908ff28eec0..800cfd1967ad 100644
--- a/drivers/vdpa/mlx5/core/mr.c
+++ b/drivers/vdpa/mlx5/core/mr.c
@@ -278,8 +278,10 @@ static int map_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr
 	mr->log_size = log_entity_size;
 	mr->nsg = nsg;
 	mr->nent = dma_map_sg_attrs(dma, mr->sg_head.sgl, mr->nsg, DMA_BIDIRECTIONAL, 0);
-	if (!mr->nent)
+	if (!mr->nent) {
+		err = -ENOMEM;
 		goto err_map;
+	}
 
 	err = create_direct_mr(mvdev, mr);
 	if (err)
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] vdpa/mlx5: Set err = -ENOMEM in case dma_map_sg_attrs fails
  2021-04-11  8:36 [PATCH] vdpa/mlx5: Set err = -ENOMEM in case dma_map_sg_attrs fails Eli Cohen
@ 2021-04-12  9:45 ` Jason Wang
  2021-04-12 12:49 ` Stefano Garzarella
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Wang @ 2021-04-12  9:45 UTC (permalink / raw)
  To: Eli Cohen, mst, si-wei.liu, virtualization, netdev
  Cc: kernel test robot, Dan Carpenter


在 2021/4/11 下午4:36, Eli Cohen 写道:
> Set err = -ENOMEM if dma_map_sg_attrs() fails so the function reutrns
> error.
>
> Fixes: 94abbccdf291 ("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>
> ---
>   drivers/vdpa/mlx5/core/mr.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/vdpa/mlx5/core/mr.c b/drivers/vdpa/mlx5/core/mr.c
> index 3908ff28eec0..800cfd1967ad 100644
> --- a/drivers/vdpa/mlx5/core/mr.c
> +++ b/drivers/vdpa/mlx5/core/mr.c
> @@ -278,8 +278,10 @@ static int map_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr
>   	mr->log_size = log_entity_size;
>   	mr->nsg = nsg;
>   	mr->nent = dma_map_sg_attrs(dma, mr->sg_head.sgl, mr->nsg, DMA_BIDIRECTIONAL, 0);
> -	if (!mr->nent)
> +	if (!mr->nent) {
> +		err = -ENOMEM;
>   		goto err_map;
> +	}
>   
>   	err = create_direct_mr(mvdev, mr);
>   	if (err)


Acked-by: Jason Wang <jasowang@redhat.com>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] vdpa/mlx5: Set err = -ENOMEM in case dma_map_sg_attrs fails
  2021-04-11  8:36 [PATCH] vdpa/mlx5: Set err = -ENOMEM in case dma_map_sg_attrs fails Eli Cohen
  2021-04-12  9:45 ` Jason Wang
@ 2021-04-12 12:49 ` Stefano Garzarella
  1 sibling, 0 replies; 3+ messages in thread
From: Stefano Garzarella @ 2021-04-12 12:49 UTC (permalink / raw)
  To: Eli Cohen
  Cc: mst, jasowang, si-wei.liu, virtualization, netdev,
	kernel test robot, Dan Carpenter

On Sun, Apr 11, 2021 at 11:36:46AM +0300, Eli Cohen wrote:
>Set err = -ENOMEM if dma_map_sg_attrs() fails so the function reutrns
>error.
>
>Fixes: 94abbccdf291 ("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>
>---
> drivers/vdpa/mlx5/core/mr.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/vdpa/mlx5/core/mr.c b/drivers/vdpa/mlx5/core/mr.c
>index 3908ff28eec0..800cfd1967ad 100644
>--- a/drivers/vdpa/mlx5/core/mr.c
>+++ b/drivers/vdpa/mlx5/core/mr.c
>@@ -278,8 +278,10 @@ static int map_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr
> 	mr->log_size = log_entity_size;
> 	mr->nsg = nsg;
> 	mr->nent = dma_map_sg_attrs(dma, mr->sg_head.sgl, mr->nsg, DMA_BIDIRECTIONAL, 0);
>-	if (!mr->nent)
>+	if (!mr->nent) {
>+		err = -ENOMEM;
> 		goto err_map;
>+	}
>
> 	err = create_direct_mr(mvdev, mr);
> 	if (err)
>-- 
>2.30.1
>

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-12 12:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-11  8:36 [PATCH] vdpa/mlx5: Set err = -ENOMEM in case dma_map_sg_attrs fails Eli Cohen
2021-04-12  9:45 ` Jason Wang
2021-04-12 12:49 ` Stefano Garzarella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).