lkml.org 
[lkml]   [2023]   [Jan]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] KVM: x86: Replace 0-length arrays with flexible arrays
On Mon, Jan 09, 2023 at 05:30:48PM +0000, Sean Christopherson wrote:
> On Thu, Jan 05, 2023, Kees Cook wrote:
> > Zero-length arrays are deprecated[1]. Replace struct kvm_nested_state's
> > "data" union 0-length arrays with flexible arrays. (How are the
> > sizes of these arrays verified?)
>
> It's not really interpreted as an array, it's a mandatory single-entry "array".
[...]
> >
> > /*
> > - * Define data region as 0 bytes to preserve backwards-compatability
> > + * Define union of flexible arrays to preserve backwards-compatability
>
> I think I'd actually prefer the "as 0 bytes" comment. The important part is that
> the size of "data" be zero, how that happens is immaterial.

Oh, dur, I can read the comment. :)

It has to stay the old size -- this was a way to add an optional extra
struct to the end. Got it!

--
Kees Cook

\
 
 \ /
  Last update: 2023-03-26 23:38    [W:0.026 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site