All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vfio/iommu_type1: replace kfree with kvfree
@ 2021-12-12  9:16 Jiacheng Shi
  2021-12-21 20:05 ` Alex Williamson
  0 siblings, 1 reply; 2+ messages in thread
From: Jiacheng Shi @ 2021-12-12  9:16 UTC (permalink / raw)
  To: Alex Williamson; +Cc: Cornelia Huck, kvm, 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: d6a4c185660c ("vfio iommu: Implementation of ioctl for dirty pages tracking")
Signed-off-by: Jiacheng Shi <billsjc@sjtu.edu.cn>
---
 drivers/vfio/vfio_iommu_type1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
index f17490ab238f..9394aa9444c1 100644
--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -256,7 +256,7 @@ static int vfio_dma_bitmap_alloc(struct vfio_dma *dma, size_t pgsize)
 
 static void vfio_dma_bitmap_free(struct vfio_dma *dma)
 {
-	kfree(dma->bitmap);
+	kvfree(dma->bitmap);
 	dma->bitmap = NULL;
 }
 
-- 
2.17.1


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

* Re: [PATCH] vfio/iommu_type1: replace kfree with kvfree
  2021-12-12  9:16 [PATCH] vfio/iommu_type1: replace kfree with kvfree Jiacheng Shi
@ 2021-12-21 20:05 ` Alex Williamson
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Williamson @ 2021-12-21 20:05 UTC (permalink / raw)
  To: Jiacheng Shi; +Cc: Cornelia Huck, kvm

On Sun, 12 Dec 2021 01:16:00 -0800
Jiacheng Shi <billsjc@sjtu.edu.cn> wrote:

> 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: d6a4c185660c ("vfio iommu: Implementation of ioctl for dirty pages tracking")
> Signed-off-by: Jiacheng Shi <billsjc@sjtu.edu.cn>
> ---
>  drivers/vfio/vfio_iommu_type1.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
> index f17490ab238f..9394aa9444c1 100644
> --- a/drivers/vfio/vfio_iommu_type1.c
> +++ b/drivers/vfio/vfio_iommu_type1.c
> @@ -256,7 +256,7 @@ static int vfio_dma_bitmap_alloc(struct vfio_dma *dma, size_t pgsize)
>  
>  static void vfio_dma_bitmap_free(struct vfio_dma *dma)
>  {
> -	kfree(dma->bitmap);
> +	kvfree(dma->bitmap);
>  	dma->bitmap = NULL;
>  }
>  

Looks good to me, applied to vfio next branch for v5.17.  Thanks,

Alex


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

end of thread, other threads:[~2021-12-21 20:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-12  9:16 [PATCH] vfio/iommu_type1: replace kfree with kvfree Jiacheng Shi
2021-12-21 20:05 ` Alex Williamson

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.