diff mbox series

[kvm-unit-tests,1/5] x86: nVMX: Check the return value of setup_eptp() in setup_ept()

Message ID 20190221022445.3873-2-sean.j.christopherson@intel.com (mailing list archive)
State New, archived
Headers show
Series x86: nVMX: Address feedback on EPT series | expand

Commit Message

Sean Christopherson Feb. 21, 2019, 2:24 a.m. UTC
A recent patch neglected to check the return value of the helper
function it factored out of setup_ept().

Fixes: d065566f60288 ("KVM: nVMX: Add enable_ept() helper to configure legal EPTP")
Reported-by: Marc Orr <marcorr@google.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 x86/vmx_tests.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Marc Orr Feb. 21, 2019, 7:17 p.m. UTC | #1
On Wed, Feb 20, 2019 at 6:24 PM Sean Christopherson
<sean.j.christopherson@intel.com> wrote:
>
> A recent patch neglected to check the return value of the helper
> function it factored out of setup_ept().
>
> Fixes: d065566f60288 ("KVM: nVMX: Add enable_ept() helper to configure legal EPTP")
> Reported-by: Marc Orr <marcorr@google.com>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
>  x86/vmx_tests.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
> index 26edbbb..66fde33 100644
> --- a/x86/vmx_tests.c
> +++ b/x86/vmx_tests.c
> @@ -1046,7 +1046,8 @@ static int setup_ept(bool enable_ad)
>
>         pml4 = alloc_page();
>
> -       setup_eptp(virt_to_phys(pml4), enable_ad);
> +       if (setup_eptp(virt_to_phys(pml4), enable_ad))
> +               return 1;
>
>         memset(pml4, 0, PAGE_SIZE);
>
> --
> 2.20.1
>

Reviewed-by: Marc Orr <marcorr@google.com>
diff mbox series

Patch

diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 26edbbb..66fde33 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -1046,7 +1046,8 @@  static int setup_ept(bool enable_ad)
 
 	pml4 = alloc_page();
 
-	setup_eptp(virt_to_phys(pml4), enable_ad);
+	if (setup_eptp(virt_to_phys(pml4), enable_ad))
+		return 1;
 
 	memset(pml4, 0, PAGE_SIZE);