From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sean Christopherson Date: Tue, 22 Oct 2019 15:22:24 +0000 Subject: Re: [PATCH v2 15/15] KVM: Dynamically size memslot array based on number of used slots Message-Id: <20191022152223.GB2343@linux.intel.com> List-Id: References: <20191022003537.13013-1-sean.j.christopherson@intel.com> <20191022003537.13013-16-sean.j.christopherson@intel.com> <2609aedc-4fc9-ab92-8877-55c64cf19165@redhat.com> In-Reply-To: <2609aedc-4fc9-ab92-8877-55c64cf19165@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Paolo Bonzini Cc: James Hogan , Paul Mackerras , Christian Borntraeger , Janosch Frank , Radim =?utf-8?B?S3LEjW3DocWZ?= , Marc Zyngier , David Hildenbrand , Cornelia Huck , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , James Morse , Julien Thierry , Suzuki K Poulose , linux-mips@vger.kernel.org, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org On Tue, Oct 22, 2019 at 04:04:21PM +0200, Paolo Bonzini wrote: > On 22/10/19 02:35, Sean Christopherson wrote: > > + struct kvm_memory_slot memslots[]; > > + /* > > + * WARNING: 'memslots' is dynamically-sized. It *MUST* be at the end. > > + */ > > Isn't that obvious from the flexible array member? Probably. It's also unnecessary as the compiler (at least as of gcc 5.4) will throw an error if it's not at the end. I think I even verified this during development and still decided to leave the obnoxious warning in for some reason... include/linux/kvm_host.h:436:25: error: flexible array member not at end of struct struct kvm_memory_slot memslots[];