* [PATCH][next] KVM: x86: Fix fall-through warnings for Clang
@ 2021-05-28 20:07 Gustavo A. R. Silva
2021-06-01 8:21 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2021-05-28 20:07 UTC (permalink / raw)
To: Paolo Bonzini, Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li,
Jim Mattson, Joerg Roedel, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, H. Peter Anvin
Cc: x86, kvm, linux-kernel, Gustavo A. R. Silva, linux-hardening
In preparation to enable -Wimplicit-fallthrough for Clang, fix a couple
of warnings by explicitly adding break statements instead of just letting
the code fall through to the next case.
Link: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
JFYI: We had thousands of these sorts of warnings and now we are down
to just 25 in linux-next. These are some of those last remaining
warnings.
arch/x86/kvm/cpuid.c | 1 +
arch/x86/kvm/vmx/vmx.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 9a48f138832d..b4da665bb892 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -655,6 +655,7 @@ static int __do_cpuid_func_emulated(struct kvm_cpuid_array *array, u32 func)
if (kvm_cpu_cap_has(X86_FEATURE_RDTSCP))
entry->ecx = F(RDPID);
++array->nent;
+ break;
default:
break;
}
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 4bceb5ca3a89..e7d98c3d398e 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -6248,6 +6248,7 @@ void vmx_set_virtual_apic_mode(struct kvm_vcpu *vcpu)
switch (kvm_get_apic_mode(vcpu)) {
case LAPIC_MODE_INVALID:
WARN_ONCE(true, "Invalid local APIC state");
+ break;
case LAPIC_MODE_DISABLED:
break;
case LAPIC_MODE_XAPIC:
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][next] KVM: x86: Fix fall-through warnings for Clang
2021-05-28 20:07 [PATCH][next] KVM: x86: Fix fall-through warnings for Clang Gustavo A. R. Silva
@ 2021-06-01 8:21 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2021-06-01 8:21 UTC (permalink / raw)
To: Gustavo A. R. Silva, Sean Christopherson, Vitaly Kuznetsov,
Wanpeng Li, Jim Mattson, Joerg Roedel, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, H. Peter Anvin
Cc: x86, kvm, linux-kernel, linux-hardening
On 28/05/21 22:07, Gustavo A. R. Silva wrote:
> In preparation to enable -Wimplicit-fallthrough for Clang, fix a couple
> of warnings by explicitly adding break statements instead of just letting
> the code fall through to the next case.
>
> Link: https://github.com/KSPP/linux/issues/115
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> ---
> JFYI: We had thousands of these sorts of warnings and now we are down
> to just 25 in linux-next. These are some of those last remaining
> warnings.
>
> arch/x86/kvm/cpuid.c | 1 +
> arch/x86/kvm/vmx/vmx.c | 1 +
> 2 files changed, 2 insertions(+)
>
> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index 9a48f138832d..b4da665bb892 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -655,6 +655,7 @@ static int __do_cpuid_func_emulated(struct kvm_cpuid_array *array, u32 func)
> if (kvm_cpu_cap_has(X86_FEATURE_RDTSCP))
> entry->ecx = F(RDPID);
> ++array->nent;
> + break;
> default:
> break;
> }
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index 4bceb5ca3a89..e7d98c3d398e 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -6248,6 +6248,7 @@ void vmx_set_virtual_apic_mode(struct kvm_vcpu *vcpu)
> switch (kvm_get_apic_mode(vcpu)) {
> case LAPIC_MODE_INVALID:
> WARN_ONCE(true, "Invalid local APIC state");
> + break;
> case LAPIC_MODE_DISABLED:
> break;
> case LAPIC_MODE_XAPIC:
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-01 8:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-28 20:07 [PATCH][next] KVM: x86: Fix fall-through warnings for Clang Gustavo A. R. Silva
2021-06-01 8:21 ` Paolo Bonzini
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).