Re: [PATCH 12/21] KVM: SEV: WARN on unhandled VM type when initializing VM

From: Sean Christopherson

Date: Thu Apr 09 2026 - 14:49:59 EST


On Thu, Apr 09, 2026, Yan Zhao wrote:
> On Tue, Mar 10, 2026 at 04:48:20PM -0700, Sean Christopherson wrote:
> > + default:
> > + WARN_ONCE(1, "Unsupported VM type %lu", kvm->arch.vm_type);
> After pulling the latest kvm-x86/next, I encountered this compilation warning:
> "arch/x86/kvm/svm/sev.c:2954:30: error: format %lu expects argument of type long
> unsigned int, but argument 2 has type int [-Werror=format=]",
>
> So,
>
> diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
> index 75d0c03d69bc..ca09c06d1e80 100644
> --- a/arch/x86/kvm/svm/sev.c
> +++ b/arch/x86/kvm/svm/sev.c
> @@ -2951,7 +2951,7 @@ void sev_vm_init(struct kvm *kvm)
> to_kvm_sev_info(kvm)->need_init = true;
> break;
> default:
> - WARN_ONCE(1, "Unsupported VM type %lu", kvm->arch.vm_type);
> + WARN_ONCE(1, "Unsupported VM type %u", kvm->arch.vm_type);
> break;
> }
> }

I'll squash the above.

How did you find this? E.g. did you cherry pick the commits into a different
tree or something? AFAICT, thanks to commit 11bb4944f014 ("x86/bug: Implement
WARN_ONCE()"), WARN() and WARN_ONCE() currently don't have any validation of
the format. I posted a patch to address that gap[*], but it's driving me crazy
that I can't reproduce the issue without explicitly removing the definition of
HAVE_ARCH_BUG_FORMAT_ARGS. :-)

[*] https://lore.kernel.org/all/20260409182941.1912856-1-seanjc@xxxxxxxxxx