Skip to contentSkip to conversation

KVM: X86: Reset the three MSR list number variables to 0 in kvm_init_msr_list()

PATCH In review Xiaoyao Li 2 participants 2 messages Nov 13, 2019

Subsystems (3)
lore
Share & tools
lore

Xiaoyao Li

author
#0 lore raw

PATCH 1/1 KVM: X86: Reset the three MSR list number variables to 0 in kvm_init_msr_list()

When applying commit 7a5ee6edb42e ("KVM: X86: Fix initialization of MSR lists"), it forgot to reset the three MSR lists number varialbes to 0 while removing the useless conditionals.

Fixes 7a5ee6edb42e (KVM: X86: Fix initialization of MSR lists)
---
 arch/x86/kvm/x86.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/x86/kvm/x86.c +4 -0
index 8c8a5e20ea06..9368b0e6bf21 100644
@@ -5102,6 +5102,10 @@ static void kvm_init_msr_list(void)
 
 	perf_get_x86_pmu_capability(&x86_pmu);
 
+	num_msrs_to_save = 0;
+	num_emulated_msrs = 0;
+	num_msr_based_features = 0;
+
 	for (i = 0; i < ARRAY_SIZE(msrs_to_save_all); i++) {
 		if (rdmsr_safe(msrs_to_save_all[i], &dummy[0], &dummy[1]) < 0)
 			continue;
Signature · 1 line
2.19.1
maintainer
#1 lore raw
Quoted 16 lines · Xiaoyao Li

When applying commit 7a5ee6edb42e ("KVM: X86: Fix initialization of MSR lists"), it forgot to reset the three MSR lists number varialbes to 0 while removing the useless conditionals.

Fixes 7a5ee6edb42e (KVM: X86: Fix initialization of MSR lists)
---
 arch/x86/kvm/x86.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/x86/kvm/x86.c +0 -0
index 8c8a5e20ea06..9368b0e6bf21 100644

arch/x86/kvm/x86.c static void kvm_init_msr_list(void) · line 5111

Quoted 10 lines
arch/x86/kvm/x86.c +4 -0
@@ -5102,6 +5102,10 @@ static void kvm_init_msr_list(void)
 
 	perf_get_x86_pmu_capability(&x86_pmu);
 
+	num_msrs_to_save = 0;
+	num_emulated_msrs = 0;
+	num_msr_based_features = 0;
+
 	for (i = 0; i < ARRAY_SIZE(msrs_to_save_all); i++) {
 		if (rdmsr_safe(msrs_to_save_all[i], &dummy[0], &dummy[1]) < 0)
 			continue;

Ouch. Sorry.

Paolo