diff mbox series

RDMA/erdma: Fix error code in erdma_create_scatter_mtt()

Message ID 1eb400d5-d8a3-4a8e-b3da-c43c6c377f86@moroto.mountain (mailing list archive)
State Accepted
Headers show
Series RDMA/erdma: Fix error code in erdma_create_scatter_mtt() | expand

Commit Message

Dan Carpenter Sept. 6, 2023, 11:23 a.m. UTC
The erdma_create_scatter_mtt() function is supposed to return error
pointers.  Returning NULL will lead to an Oops.

Fixes: ed10435d3583 ("RDMA/erdma: Implement hierarchical MTT")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/infiniband/hw/erdma/erdma_verbs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Cheng Xu Sept. 8, 2023, 2:21 a.m. UTC | #1
On 9/6/23 7:23 PM, Dan Carpenter wrote:
> The erdma_create_scatter_mtt() function is supposed to return error
> pointers.  Returning NULL will lead to an Oops.
> 
> Fixes: ed10435d3583 ("RDMA/erdma: Implement hierarchical MTT")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  drivers/infiniband/hw/erdma/erdma_verbs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Acked-by: Cheng Xu <chengyou@linux.alibaba.com>

Thanks very much!

Cheng Xu
Leon Romanovsky Sept. 18, 2023, 6:12 a.m. UTC | #2
On Wed, 06 Sep 2023 14:23:52 +0300, Dan Carpenter wrote:
> The erdma_create_scatter_mtt() function is supposed to return error
> pointers.  Returning NULL will lead to an Oops.
> 
> 

Applied, thanks!

[1/1] RDMA/erdma: Fix error code in erdma_create_scatter_mtt()
      https://git.kernel.org/rdma/rdma/c/6b5f0749ce48c1

Best regards,
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/erdma/erdma_verbs.c b/drivers/infiniband/hw/erdma/erdma_verbs.c
index dcccb6015232..70eaed59a67c 100644
--- a/drivers/infiniband/hw/erdma/erdma_verbs.c
+++ b/drivers/infiniband/hw/erdma/erdma_verbs.c
@@ -655,7 +655,7 @@  static struct erdma_mtt *erdma_create_scatter_mtt(struct erdma_dev *dev,
 
 	mtt = kzalloc(sizeof(*mtt), GFP_KERNEL);
 	if (!mtt)
-		return NULL;
+		return ERR_PTR(-ENOMEM);
 
 	mtt->size = ALIGN(size, PAGE_SIZE);
 	mtt->buf = vzalloc(mtt->size);