All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDMA/hns: Replace kfree with kvfree
@ 2021-12-10  9:42 Jiacheng Shi
  2021-12-14 14:14 ` Wenpeng Liang
  2021-12-15  0:17 ` Jason Gunthorpe
  0 siblings, 2 replies; 4+ messages in thread
From: Jiacheng Shi @ 2021-12-10  9:42 UTC (permalink / raw)
  To: Wenpeng Liang, Weihang Li; +Cc: linux-rdma, Jiacheng Shi

Variables allocated by kvmalloc_array should not be freed by kfree.
Because they may be allocated by vmalloc.
So we replace kfree with kvfree here.

Fixes: 6fd610c5733d ("RDMA/hns: Support 0 hop addressing for SRQ buffer")
Signed-off-by: Jiacheng Shi <billsjc@sjtu.edu.cn>
---
 drivers/infiniband/hw/hns/hns_roce_srq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_srq.c b/drivers/infiniband/hw/hns/hns_roce_srq.c
index 6eee9deadd12..e64ef6903fb4 100644
--- a/drivers/infiniband/hw/hns/hns_roce_srq.c
+++ b/drivers/infiniband/hw/hns/hns_roce_srq.c
@@ -259,7 +259,7 @@ static int alloc_srq_wrid(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq)
 
 static void free_srq_wrid(struct hns_roce_srq *srq)
 {
-	kfree(srq->wrid);
+	kvfree(srq->wrid);
 	srq->wrid = NULL;
 }
 
-- 
2.17.1


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

* Re: [PATCH] RDMA/hns: Replace kfree with kvfree
  2021-12-10  9:42 [PATCH] RDMA/hns: Replace kfree with kvfree Jiacheng Shi
@ 2021-12-14 14:14 ` Wenpeng Liang
  2021-12-15  0:17 ` Jason Gunthorpe
  1 sibling, 0 replies; 4+ messages in thread
From: Wenpeng Liang @ 2021-12-14 14:14 UTC (permalink / raw)
  To: Jiacheng Shi, Weihang Li; +Cc: linux-rdma

On 2021/12/10 17:42, Jiacheng Shi wrote:
> Variables allocated by kvmalloc_array should not be freed by kfree.
> Because they may be allocated by vmalloc.
> So we replace kfree with kvfree here.
> 
> Fixes: 6fd610c5733d ("RDMA/hns: Support 0 hop addressing for SRQ buffer")
> Signed-off-by: Jiacheng Shi <billsjc@sjtu.edu.cn>
> ---
>  drivers/infiniband/hw/hns/hns_roce_srq.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/hw/hns/hns_roce_srq.c b/drivers/infiniband/hw/hns/hns_roce_srq.c
> index 6eee9deadd12..e64ef6903fb4 100644
> --- a/drivers/infiniband/hw/hns/hns_roce_srq.c
> +++ b/drivers/infiniband/hw/hns/hns_roce_srq.c
> @@ -259,7 +259,7 @@ static int alloc_srq_wrid(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq)
>  
>  static void free_srq_wrid(struct hns_roce_srq *srq)
>  {
> -	kfree(srq->wrid);
> +	kvfree(srq->wrid);
>  	srq->wrid = NULL;
>  }
>  
> 

Thanks for the patch.

Acked-by: Wenpeng Liang <liangwenpeng@huawei.com>

Thanks
Wenpeng

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

* Re: [PATCH] RDMA/hns: Replace kfree with kvfree
  2021-12-10  9:42 [PATCH] RDMA/hns: Replace kfree with kvfree Jiacheng Shi
  2021-12-14 14:14 ` Wenpeng Liang
@ 2021-12-15  0:17 ` Jason Gunthorpe
  1 sibling, 0 replies; 4+ messages in thread
From: Jason Gunthorpe @ 2021-12-15  0:17 UTC (permalink / raw)
  To: Jiacheng Shi; +Cc: Wenpeng Liang, Weihang Li, linux-rdma

On Fri, Dec 10, 2021 at 01:42:34AM -0800, Jiacheng Shi wrote:
> Variables allocated by kvmalloc_array should not be freed by kfree.
> Because they may be allocated by vmalloc.
> So we replace kfree with kvfree here.
> 
> Fixes: 6fd610c5733d ("RDMA/hns: Support 0 hop addressing for SRQ buffer")
> Signed-off-by: Jiacheng Shi <billsjc@sjtu.edu.cn>
> Acked-by: Wenpeng Liang <liangwenpeng@huawei.com>
> ---
>  drivers/infiniband/hw/hns/hns_roce_srq.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-rc, thanks

Jason

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

* [PATCH] RDMA/hns: Replace kfree with kvfree
@ 2021-12-10  9:32 Jiacheng Shi
  0 siblings, 0 replies; 4+ messages in thread
From: Jiacheng Shi @ 2021-12-10  9:32 UTC (permalink / raw)
  To: Wenpeng Liang, Weihang Li; +Cc: linux-rdma, Jiacheng Shi

Variables allocated by kvzalloc should not be freed by kfree.
Because they may be allocated by vmalloc.
So we replace kfree with kvfree here.

Fixes: 6fd610c5733d ("RDMA/hns: Support 0 hop addressing for SRQ buffer")
Signed-off-by: Jiacheng Shi <billsjc@sjtu.edu.cn>
---
 drivers/infiniband/hw/hns/hns_roce_srq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_srq.c b/drivers/infiniband/hw/hns/hns_roce_srq.c
index 6eee9deadd12..e64ef6903fb4 100644
--- a/drivers/infiniband/hw/hns/hns_roce_srq.c
+++ b/drivers/infiniband/hw/hns/hns_roce_srq.c
@@ -259,7 +259,7 @@ static int alloc_srq_wrid(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq)
 
 static void free_srq_wrid(struct hns_roce_srq *srq)
 {
-	kfree(srq->wrid);
+	kvfree(srq->wrid);
 	srq->wrid = NULL;
 }
 
-- 
2.17.1


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

end of thread, other threads:[~2021-12-15  0:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-10  9:42 [PATCH] RDMA/hns: Replace kfree with kvfree Jiacheng Shi
2021-12-14 14:14 ` Wenpeng Liang
2021-12-15  0:17 ` Jason Gunthorpe
  -- strict thread matches above, loose matches on Subject: below --
2021-12-10  9:32 Jiacheng Shi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.