Skip to contentSkip to conversation

KVM: x86: Fix print format and coding style

PATCH Applied linmiaohe 3 participants 3 messages Feb 15, 2020 – Feb 17, 2020

Subsystems (3)
lore
Share & tools
lore

linmiaohe

author
#0 lore raw

PATCH 1/1 KVM: x86: Fix print format and coding style

From: Miaohe Lin <[email protected]>

Use %u to print u32 var and correct some coding style.

---
 arch/x86/kvm/i8254.c      | 2 +-
 arch/x86/kvm/mmu/mmu.c    | 3 +--
 arch/x86/kvm/vmx/nested.c | 2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)
arch/x86/kvm/i8254.c +1 -1
index b24c606ac04b..febca334c320 100644
@@ -367,7 +367,7 @@ static void pit_load_count(struct kvm_pit *pit, int channel, u32 val)
 {
 	struct kvm_kpit_state *ps = &pit->pit_state;
 
-	pr_debug("load_count val is %d, channel is %d\n", val, channel);
+	pr_debug("load_count val is %u, channel is %d\n", val, channel);
 
 	/*
 	 * The largest possible initial count is 0; this is equivalent
arch/x86/kvm/mmu/mmu.c +1 -2
index 7011a4e54866..9c228b9910b1 100644
@@ -3568,8 +3568,7 @@ static bool fast_page_fault(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa,
 		 * write-protected for dirty-logging or access tracking.
 		 */
 		if ((error_code & PFERR_WRITE_MASK) &&
-		    spte_can_locklessly_be_made_writable(spte))
-		{
+		    spte_can_locklessly_be_made_writable(spte)) {
 			new_spte |= PT_WRITABLE_MASK;
 
 			/*
arch/x86/kvm/vmx/nested.c +1 -1
index f2d8cb68dce8..6f3e515f28fd 100644
@@ -4367,7 +4367,7 @@ int get_vmx_mem_address(struct kvm_vcpu *vcpu, unsigned long exit_qualification,
 	if (base_is_valid)
 		off += kvm_register_read(vcpu, base_reg);
 	if (index_is_valid)
-		off += kvm_register_read(vcpu, index_reg)<<scaling;
+		off += kvm_register_read(vcpu, index_reg) << scaling;
 	vmx_get_segment(vcpu, &s, seg_reg);
 
 	/*
Signature · 1 line
2.19.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 43 lines · linmiaohe

From: Miaohe Lin <[email protected]>

Use %u to print u32 var and correct some coding style.

---
 arch/x86/kvm/i8254.c      | 2 +-
 arch/x86/kvm/mmu/mmu.c    | 3 +--
 arch/x86/kvm/vmx/nested.c | 2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)
arch/x86/kvm/i8254.c +1 -1
index b24c606ac04b..febca334c320 100644
@@ -367,7 +367,7 @@ static void pit_load_count(struct kvm_pit *pit, int channel, u32 val)
 {
 	struct kvm_kpit_state *ps = &pit->pit_state;
 
-	pr_debug("load_count val is %d, channel is %d\n", val, channel);
+	pr_debug("load_count val is %u, channel is %d\n", val, channel);
 
 	/*
 	 * The largest possible initial count is 0; this is equivalent
arch/x86/kvm/mmu/mmu.c +1 -2
index 7011a4e54866..9c228b9910b1 100644
@@ -3568,8 +3568,7 @@ static bool fast_page_fault(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa,
 		 * write-protected for dirty-logging or access tracking.
 		 */
 		if ((error_code & PFERR_WRITE_MASK) &&
-		    spte_can_locklessly_be_made_writable(spte))
-		{
+		    spte_can_locklessly_be_made_writable(spte)) {
 			new_spte |= PT_WRITABLE_MASK;
 
 			/*
arch/x86/kvm/vmx/nested.c +0 -0
index f2d8cb68dce8..6f3e515f28fd 100644

arch/x86/kvm/vmx/nested.c int get_vmx_mem_address(struct kvm_vcpu *vcpu, unsigned long exit_qualification, · line 4373

Quoted 8 lines
arch/x86/kvm/vmx/nested.c +1 -1
@@ -4367,7 +4367,7 @@ int get_vmx_mem_address(struct kvm_vcpu *vcpu, unsigned long exit_qualification,
 	if (base_is_valid)
 		off += kvm_register_read(vcpu, base_reg);
 	if (index_is_valid)
-		off += kvm_register_read(vcpu, index_reg)<<scaling;
+		off += kvm_register_read(vcpu, index_reg) << scaling;
 	vmx_get_segment(vcpu, &s, seg_reg);
 
 	/*

I would've suggested we split such unrelated changes by source files in the future to simplify (possible) stable backporting. Changes themselves look good,

Signature · 1 line
Vitaly
maintainer Applied
#2 lore raw
Quoted 3 lines · Vitaly Kuznetsov

I would've suggested we split such unrelated changes by source files in the future to simplify (possible) stable backporting. Changes themselves look good,

In this case I think it's trivial enough that we shouldn't have any problem backporting to stable, but in general I agree.

Queued, thanks.

Paolo