git: 272525b73b65 - stable/13 - vmm: Fix casts around kmem_malloc/free() calls

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Thu, 11 May 2023 15:04:26 UTC
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=272525b73b6548d84b3cea84579c6dd9a1e0a961

commit 272525b73b6548d84b3cea84579c6dd9a1e0a961
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-05-11 15:00:53 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-05-11 15:00:53 +0000

    vmm: Fix casts around kmem_malloc/free() calls
    
    This is a direct commit to stable/13.
    
    Reported by:    Jenkins
---
 sys/amd64/vmm/amd/svm.c   | 4 ++--
 sys/amd64/vmm/intel/vmx.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/amd64/vmm/amd/svm.c b/sys/amd64/vmm/amd/svm.c
index d295401a9043..bd0c4db20b3d 100644
--- a/sys/amd64/vmm/amd/svm.c
+++ b/sys/amd64/vmm/amd/svm.c
@@ -168,7 +168,7 @@ svm_modcleanup(void)
 	smp_rendezvous(NULL, svm_disable, NULL, NULL);
 
 	if (hsave != NULL)
-		kmem_free(hsave, (mp_maxid + 1) * PAGE_SIZE);
+		kmem_free((vm_offset_t)hsave, (mp_maxid + 1) * PAGE_SIZE);
 
 	return (0);
 }
@@ -272,7 +272,7 @@ svm_modinit(int ipinum)
 	svm_npt_init(ipinum);
 
 	/* Enable SVM on all CPUs */
-	hsave = kmem_malloc((mp_maxid + 1) * PAGE_SIZE, M_WAITOK | M_ZERO);
+	hsave = (void *)kmem_malloc((mp_maxid + 1) * PAGE_SIZE, M_WAITOK | M_ZERO);
 	smp_rendezvous(NULL, svm_enable, NULL, NULL);
 
 	return (0);
diff --git a/sys/amd64/vmm/intel/vmx.c b/sys/amd64/vmm/intel/vmx.c
index 8b8f8fe6cb25..fe8f9b40a7d0 100644
--- a/sys/amd64/vmm/intel/vmx.c
+++ b/sys/amd64/vmm/intel/vmx.c
@@ -621,7 +621,7 @@ vmx_modcleanup(void)
 	smp_rendezvous(NULL, vmx_disable, NULL, NULL);
 
 	if (vmxon_region != NULL)
-		kmem_free(vmxon_region, (mp_maxid + 1) * PAGE_SIZE);
+		kmem_free((vm_offset_t)vmxon_region, (mp_maxid + 1) * PAGE_SIZE);
 
 	return (0);
 }
@@ -957,7 +957,7 @@ vmx_modinit(int ipinum)
 	vmx_msr_init();
 
 	/* enable VMX operation */
-	vmxon_region = kmem_malloc((mp_maxid + 1) * PAGE_SIZE,
+	vmxon_region = (void *)kmem_malloc((mp_maxid + 1) * PAGE_SIZE,
 	    M_WAITOK | M_ZERO);
 	smp_rendezvous(NULL, vmx_enable, NULL, NULL);