]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: Remove subtle "struct kvm_stats_desc" pseudo-overlay
authorSean Christopherson <seanjc@google.com>
Mon, 13 Apr 2026 13:01:24 +0000 (09:01 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Apr 2026 11:22:30 +0000 (13:22 +0200)
commitdf61c2c99c7ff9ff79912afa085b28443d766762
tree5b35010bed3e8a9337a3eb85ebc243d21fc63a7c
parent9309daac503430b1c24e74a176b54b25f4d6c876
KVM: Remove subtle "struct kvm_stats_desc" pseudo-overlay

[ Upstream commit da142f3d373a6ddaca0119615a8db2175ddc4121 ]

Remove KVM's internal pseudo-overlay of kvm_stats_desc, which subtly
aliases the flexible name[] in the uAPI definition with a fixed-size array
of the same name.  The unusual embedded structure results in compiler
warnings due to -Wflex-array-member-not-at-end, and also necessitates an
extra level of dereferencing in KVM.  To avoid the "overlay", define the
uAPI structure to have a fixed-size name when building for the kernel.

Opportunistically clean up the indentation for the stats macros, and
replace spaces with tabs.

No functional change intended.

Reported-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Closes: https://lore.kernel.org/all/aPfNKRpLfhmhYqfP@kspp
Acked-by: Marc Zyngier <maz@kernel.org>
Acked-by: Christian Borntraeger <borntraeger@linux.ibm.com>
[..]
Acked-by: Anup Patel <anup@brainfault.org>
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
Acked-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://patch.msgid.link/20251205232655.445294-1-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Stable-dep-of: 2619da73bb2f ("KVM: x86: Use __DECLARE_FLEX_ARRAY() for UAPI structures with VLAs")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
14 files changed:
arch/arm64/kvm/guest.c
arch/loongarch/kvm/vcpu.c
arch/loongarch/kvm/vm.c
arch/mips/kvm/mips.c
arch/powerpc/kvm/book3s.c
arch/powerpc/kvm/booke.c
arch/riscv/kvm/vcpu.c
arch/riscv/kvm/vm.c
arch/s390/kvm/kvm-s390.c
arch/x86/kvm/x86.c
include/linux/kvm_host.h
include/uapi/linux/kvm.h
virt/kvm/binary_stats.c
virt/kvm/kvm_main.c