[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8f1c1b9e-2743-4326-9a6f-754885ae90f4@linux.ibm.com>
Date: Mon, 8 Dec 2025 11:32:27 +0100
From: Christian Borntraeger <borntraeger@...ux.ibm.com>
To: Sean Christopherson <seanjc@...gle.com>, Marc Zyngier <maz@...nel.org>,
Oliver Upton <oupton@...nel.org>,
Tianrui Zhao <zhaotianrui@...ngson.cn>, Bibo Mao <maobibo@...ngson.cn>,
Huacai Chen <chenhuacai@...nel.org>,
Madhavan Srinivasan <maddy@...ux.ibm.com>,
Anup Patel <anup@...infault.org>, Paul Walmsley <pjw@...nel.org>,
Palmer Dabbelt <palmer@...belt.com>, Albert Ou <aou@...s.berkeley.edu>,
Janosch Frank <frankja@...ux.ibm.com>,
Claudio Imbrenda <imbrenda@...ux.ibm.com>,
Paolo Bonzini <pbonzini@...hat.com>
Cc: linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.linux.dev,
kvm@...r.kernel.org, loongarch@...ts.linux.dev,
linux-mips@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
kvm-riscv@...ts.infradead.org, linux-riscv@...ts.infradead.org,
linux-kernel@...r.kernel.org,
"Gustavo A . R . Silva" <gustavoars@...nel.org>
Subject: Re: [PATCH] KVM: Remove subtle "struct kvm_stats_desc" pseudo-overlay
Am 06.12.25 um 00:26 schrieb Sean Christopherson:
> 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@...nel.org>
> Closes: https://lore.kernel.org/all/aPfNKRpLfhmhYqfP@kspp
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>
Acked-by: Christian Borntraeger <borntraeger@...ux.ibm.com>
[..]
> --- a/include/uapi/linux/kvm.h
> +++ b/include/uapi/linux/kvm.h
> @@ -14,6 +14,10 @@
> #include <linux/ioctl.h>
> #include <asm/kvm.h>
>
> +#ifdef __KERNEL__
> +#include <linux/kvm_types.h>
> +#endif
> +
> #define KVM_API_VERSION 12
>
> /*
> @@ -1579,7 +1583,11 @@ struct kvm_stats_desc {
> __u16 size;
> __u32 offset;
> __u32 bucket_size;
> +#ifdef __KERNEL__
> + char name[KVM_STATS_NAME_SIZE];
> +#else
> char name[];
> +#endif
> };
Not sure if we need a comment here or not. Maybe git blame is good enough.
Powered by blists - more mailing lists