diff mbox

KVM: nVMX: fix boolreturn.cocci warnings

Message ID 20170727220315.GA45672@lkp-ib04 (mailing list archive)
State New, archived
Headers show

Commit Message

Fengguang Wu July 27, 2017, 10:03 p.m. UTC
arch/x86/kvm/vmx.c:8192:8-9: WARNING: return of 0/1 in function 'nested_vmx_reflect_vmexit' with return type bool

 Return statements in functions returning bool should use
 true/false instead of 1/0.
Generated by: scripts/coccinelle/misc/boolreturn.cocci

Fixes: fef40abd18fd ("KVM: nVMX: do not fill vm_exit_intr_error_code in prepare_vmcs12")
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

 vmx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Radim Krčmář Aug. 1, 2017, 8:39 p.m. UTC | #1
2017-07-28 06:03+0800, kbuild test robot:
> arch/x86/kvm/vmx.c:8192:8-9: WARNING: return of 0/1 in function 'nested_vmx_reflect_vmexit' with return type bool
> 
>  Return statements in functions returning bool should use
>  true/false instead of 1/0.
> Generated by: scripts/coccinelle/misc/boolreturn.cocci
> 
> Fixes: fef40abd18fd ("KVM: nVMX: do not fill vm_exit_intr_error_code in prepare_vmcs12")
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> ---
> 
>  vmx.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -8189,7 +8189,7 @@ static bool nested_vmx_reflect_vmexit(st
>  
>  	nested_vmx_vmexit(vcpu, exit_reason, exit_intr_info,
>  			  vmcs_readl(EXIT_QUALIFICATION));
> -	return 1;
> +	return true;

We actually wanted to return 1, which means "do not exit to user-space",
so I've changed the return type to int instead and pushed to kvm/queue.

Thanks for the report!

>  }
>  
>  static void vmx_get_exit_info(struct kvm_vcpu *vcpu, u64 *info1, u64 *info2)
diff mbox

Patch

--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -8189,7 +8189,7 @@  static bool nested_vmx_reflect_vmexit(st
 
 	nested_vmx_vmexit(vcpu, exit_reason, exit_intr_info,
 			  vmcs_readl(EXIT_QUALIFICATION));
-	return 1;
+	return true;
 }
 
 static void vmx_get_exit_info(struct kvm_vcpu *vcpu, u64 *info1, u64 *info2)