Re: [PATCH 01/26] KVM: x86: Remove superfluous brackets from case statement

Vitaly Kuznetsov
2020-02-05T14:29:35Z

Sean Christopherson <sean.j.christopherson@intel.com> writes:

> Remove unnecessary brackets from a case statement that unintentionally
> encapsulates unrelated case statements in the same switch statement.
> While technically legal and functionally correct syntax, the brackets
> are visually confusing and potentially dangerous, e.g. the last of the
> encapsulated case statements has an undocumented fall-through that isn't
> flagged by compilers due the encapsulation.
>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
> arch/x86/kvm/x86.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 7e3f1d937224..24597526b5de 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -5260,7 +5260,7 @@ static void kvm_init_msr_list(void)
> !intel_pt_validate_hw_cap(PT_CAP_single_range_output)))
> continue;
> break;
> - case MSR_IA32_RTIT_ADDR0_A ... MSR_IA32_RTIT_ADDR3_B: {
> + case MSR_IA32_RTIT_ADDR0_A ... MSR_IA32_RTIT_ADDR3_B:
> if (!kvm_x86_ops->pt_supported() ||
> msrs_to_save_all[i] - MSR_IA32_RTIT_ADDR0_A >=
> intel_pt_validate_hw_cap(PT_CAP_num_address_ranges) * 2)
> @@ -5275,7 +5275,7 @@ static void kvm_init_msr_list(void)
> if (msrs_to_save_all[i] - MSR_ARCH_PERFMON_EVENTSEL0 >=
> min(INTEL_PMC_MAX_GENERIC, x86_pmu.num_counters_gp))
> continue;
> - }
> + break;
> default:
> break;
> }

Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>

--
Vitaly