[PATCH] kvm: x86/mmu: Assign boolean values to a bool variable

From: Jiapeng Zhong
Date: Thu Jan 21 2021 - 02:28:42 EST


Fix the following coccicheck warnings:

./arch/x86/kvm/mmu/mmu.c:5829:2-9: WARNING: Assignment of 0/1
to bool variable.

./arch/x86/kvm/mmu/mmu.c:2505:1-11: WARNING: Assignment of 0/1
to bool variable.

./arch/x86/kvm/mmu/mmu.c:1814:1-11: WARNING: Assignment of 0/1
to bool variable.

Reported-by: Abaci Robot <abaci@xxxxxxxxxxxxxxxxx>
Signed-off-by: Jiapeng Zhong <abaci-bugfix@xxxxxxxxxxxxxxxxx>
---
arch/x86/kvm/mmu/mmu.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 6d16481..ced0bd5 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -1819,7 +1819,7 @@ static void kvm_unlink_unsync_page(struct kvm *kvm, struct kvm_mmu_page *sp)
{
WARN_ON(!sp->unsync);
trace_kvm_mmu_sync_page(sp);
- sp->unsync = 0;
+ sp->unsync = false;
--kvm->stat.mmu_unsync;
}

@@ -2510,7 +2510,7 @@ static void kvm_unsync_page(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
{
trace_kvm_mmu_unsync_page(sp);
++vcpu->kvm->stat.mmu_unsync;
- sp->unsync = 1;
+ sp->unsync = true;

kvm_mmu_mark_parents_unsync(sp);
}
@@ -5839,9 +5839,9 @@ static int set_nx_huge_pages(const char *val, const struct kernel_param *kp)

/* In "auto" mode deploy workaround only if CPU has the bug. */
if (sysfs_streq(val, "off"))
- new_val = 0;
+ new_val = false;
else if (sysfs_streq(val, "force"))
- new_val = 1;
+ new_val = true;
else if (sysfs_streq(val, "auto"))
new_val = get_nx_auto_mode();
else if (strtobool(val, &new_val) < 0)
--
1.8.3.1