* [PATCH] KVM: vmx: Assign boolean values to a bool variable
@ 2021-01-21 8:48 Jiapeng Zhong
2021-01-21 15:47 ` Peter Zijlstra
0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Zhong @ 2021-01-21 8:48 UTC (permalink / raw)
To: pbonzini
Cc: seanjc, vkuznets, wanpengli, jmattson, joro, tglx, mingo, bp,
x86, hpa, kvm, linux-kernel, Jiapeng Zhong
Fix the following coccicheck warnings:
./arch/x86/kvm/vmx/vmx.c:6798:1-27: WARNING: Assignment of 0/1
to bool variable.
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Zhong <abaci-bugfix@linux.alibaba.com>
---
arch/x86/kvm/vmx/vmx.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 2af05d3..8d51135 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -743,7 +743,7 @@ static void __loaded_vmcs_clear(void *arg)
smp_wmb();
loaded_vmcs->cpu = -1;
- loaded_vmcs->launched = 0;
+ loaded_vmcs->launched = false;
}
void loaded_vmcs_clear(struct loaded_vmcs *loaded_vmcs)
@@ -2621,7 +2621,7 @@ int alloc_loaded_vmcs(struct loaded_vmcs *loaded_vmcs)
loaded_vmcs->shadow_vmcs = NULL;
loaded_vmcs->hv_timer_soft_disabled = false;
loaded_vmcs->cpu = -1;
- loaded_vmcs->launched = 0;
+ loaded_vmcs->launched = false;
if (cpu_has_vmx_msr_bitmap()) {
loaded_vmcs->msr_bitmap = (unsigned long *)
@@ -4211,7 +4211,7 @@ static void vmx_compute_secondary_exec_control(struct vcpu_vmx *vmx)
exec_control &= ~SECONDARY_EXEC_ENABLE_VPID;
if (!enable_ept) {
exec_control &= ~SECONDARY_EXEC_ENABLE_EPT;
- enable_unrestricted_guest = 0;
+ enable_unrestricted_guest = false;
}
if (!enable_unrestricted_guest)
exec_control &= ~SECONDARY_EXEC_UNRESTRICTED_GUEST;
@@ -6762,7 +6762,7 @@ static fastpath_t vmx_vcpu_run(struct kvm_vcpu *vcpu)
kvm_load_host_xsave_state(vcpu);
- vmx->nested.nested_run_pending = 0;
+ vmx->nested.nested_run_pending = false;
vmx->idt_vectoring_info = 0;
if (unlikely(vmx->fail)) {
@@ -6779,7 +6779,7 @@ static fastpath_t vmx_vcpu_run(struct kvm_vcpu *vcpu)
if (unlikely(vmx->exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY))
return EXIT_FASTPATH_NONE;
- vmx->loaded_vmcs->launched = 1;
+ vmx->loaded_vmcs->launched = true;
vmx->idt_vectoring_info = vmcs_read32(IDT_VECTORING_INFO_FIELD);
vmx_recover_nmi_blocking(vmx);
@@ -7740,25 +7740,25 @@ static __init int hardware_setup(void)
if (!cpu_has_vmx_vpid() || !cpu_has_vmx_invvpid() ||
!(cpu_has_vmx_invvpid_single() || cpu_has_vmx_invvpid_global()))
- enable_vpid = 0;
+ enable_vpid = false;
if (!cpu_has_vmx_ept() ||
!cpu_has_vmx_ept_4levels() ||
!cpu_has_vmx_ept_mt_wb() ||
!cpu_has_vmx_invept_global())
- enable_ept = 0;
+ enable_ept = false;
if (!cpu_has_vmx_ept_ad_bits() || !enable_ept)
- enable_ept_ad_bits = 0;
+ enable_ept_ad_bits = false;
if (!cpu_has_vmx_unrestricted_guest() || !enable_ept)
- enable_unrestricted_guest = 0;
+ enable_unrestricted_guest = false;
if (!cpu_has_vmx_flexpriority())
- flexpriority_enabled = 0;
+ flexpriority_enabled = false;
if (!cpu_has_virtual_nmis())
- enable_vnmi = 0;
+ enable_vnmi = false;
/*
* set_apic_access_page_addr() is used to reload apic access
@@ -7789,7 +7789,7 @@ static __init int hardware_setup(void)
}
if (!cpu_has_vmx_apicv()) {
- enable_apicv = 0;
+ enable_apicv = false;
vmx_x86_ops.sync_pir_to_irr = NULL;
}
@@ -7819,7 +7819,7 @@ static __init int hardware_setup(void)
* and EPT A/D bit features are enabled -- PML depends on them to work.
*/
if (!enable_ept || !enable_ept_ad_bits || !cpu_has_vmx_pml())
- enable_pml = 0;
+ enable_pml = false;
if (!enable_pml) {
vmx_x86_ops.slot_enable_log_dirty = NULL;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] KVM: vmx: Assign boolean values to a bool variable
2021-01-21 8:48 [PATCH] KVM: vmx: Assign boolean values to a bool variable Jiapeng Zhong
@ 2021-01-21 15:47 ` Peter Zijlstra
0 siblings, 0 replies; 2+ messages in thread
From: Peter Zijlstra @ 2021-01-21 15:47 UTC (permalink / raw)
To: Jiapeng Zhong
Cc: pbonzini, seanjc, vkuznets, wanpengli, jmattson, joro, tglx,
mingo, bp, x86, hpa, kvm, linux-kernel
On Thu, Jan 21, 2021 at 04:48:26PM +0800, Jiapeng Zhong wrote:
> Fix the following coccicheck warnings:
>
> ./arch/x86/kvm/vmx/vmx.c:6798:1-27: WARNING: Assignment of 0/1
> to bool variable.
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Your robot is running old scripts; please see commit:
2b076054e524 ("remove boolinit.cocci")
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-21 16:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-21 8:48 [PATCH] KVM: vmx: Assign boolean values to a bool variable Jiapeng Zhong
2021-01-21 15:47 ` Peter Zijlstra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).