diff mbox series

[42/51] hw/ppc: spapr: Use qemu_vfree() to free spapr->htab

Message ID 20220824094029.1634519-43-bmeng.cn@gmail.com (mailing list archive)
State New, archived
Headers show
Series tests/qtest: Enable running qtest on Windows | expand

Commit Message

Bin Meng Aug. 24, 2022, 9:40 a.m. UTC
From: Xuzhou Cheng <xuzhou.cheng@windriver.com>

spapr->htab is allocated by qemu_memalign(), hence we should use
qemu_vfree() to free it.

Fixes: c5f54f3e31bf ("pseries: Move hash page table allocation to reset time")
Fixes: b4db54132ffe ("target/ppc: Implement H_REGISTER_PROCESS_TABLE H_CALL"")
Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com>
Signed-off-by: Bin Meng <bin.meng@windriver.com>
---

 hw/ppc/spapr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Daniel Henrique Barboza Aug. 24, 2022, 5:32 p.m. UTC | #1
On 8/24/22 06:40, Bin Meng wrote:
> From: Xuzhou Cheng <xuzhou.cheng@windriver.com>
> 
> spapr->htab is allocated by qemu_memalign(), hence we should use
> qemu_vfree() to free it.
> 
> Fixes: c5f54f3e31bf ("pseries: Move hash page table allocation to reset time")
> Fixes: b4db54132ffe ("target/ppc: Implement H_REGISTER_PROCESS_TABLE H_CALL"")
> Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com>
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> ---

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>

> 
>   hw/ppc/spapr.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index bc9ba6e6dc..4034f4d130 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -1522,7 +1522,7 @@ int spapr_hpt_shift_for_ramsize(uint64_t ramsize)
>   
>   void spapr_free_hpt(SpaprMachineState *spapr)
>   {
> -    g_free(spapr->htab);
> +    qemu_vfree(spapr->htab);
>       spapr->htab = NULL;
>       spapr->htab_shift = 0;
>       close_htab_fd(spapr);
Marc-André Lureau Sept. 1, 2022, 11:40 a.m. UTC | #2
On Wed, Aug 24, 2022 at 3:18 PM Bin Meng <bmeng.cn@gmail.com> wrote:

> From: Xuzhou Cheng <xuzhou.cheng@windriver.com>
>
> spapr->htab is allocated by qemu_memalign(), hence we should use
> qemu_vfree() to free it.
>
> Fixes: c5f54f3e31bf ("pseries: Move hash page table allocation to reset
> time")
> Fixes: b4db54132ffe ("target/ppc: Implement H_REGISTER_PROCESS_TABLE
> H_CALL"")
> Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com>
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>
>  hw/ppc/spapr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index bc9ba6e6dc..4034f4d130 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -1522,7 +1522,7 @@ int spapr_hpt_shift_for_ramsize(uint64_t ramsize)
>
>  void spapr_free_hpt(SpaprMachineState *spapr)
>  {
> -    g_free(spapr->htab);
> +    qemu_vfree(spapr->htab);
>      spapr->htab = NULL;
>      spapr->htab_shift = 0;
>      close_htab_fd(spapr);
> --
> 2.34.1
>
>
>
diff mbox series

Patch

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index bc9ba6e6dc..4034f4d130 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1522,7 +1522,7 @@  int spapr_hpt_shift_for_ramsize(uint64_t ramsize)
 
 void spapr_free_hpt(SpaprMachineState *spapr)
 {
-    g_free(spapr->htab);
+    qemu_vfree(spapr->htab);
     spapr->htab = NULL;
     spapr->htab_shift = 0;
     close_htab_fd(spapr);