[Top] [All Lists]

Re: [PATCH v2] xfs: Silence bounds checking compiler warning

To: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
Subject: Re: [PATCH v2] xfs: Silence bounds checking compiler warning
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Thu, 23 Jun 2011 14:13:17 -0400
Cc: Andi Kleen <andi@xxxxxxxxxxxxxx>, Maarten Lankhorst <m.b.lankhorst@xxxxxxxxx>, Alex Elder <aelder@xxxxxxx>, xfs-masters@xxxxxxxxxxx, Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>, xfs@xxxxxxxxxxx
In-reply-to: <20110623175533.GK11521@xxxxxxxxxxxxxxxxxx>
References: <4E037001.8090306__42924.0493024283$1308849791$gmane$org@xxxxxxxxx> <m2boxocvb5.fsf@xxxxxxxxxxxxxx> <20110623175533.GK11521@xxxxxxxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Thu, Jun 23, 2011 at 06:55:33PM +0100, Al Viro wrote:
> ... and even better is to write in real C and have u8 name[]; in the
> end of your structure.  That's the standard C99 for this kind of thing
> (see, p16).  Zero-sized array is a gccism predating standard
> flexible array members and since the standard syntax is accepted by
> any gcc version that might be recent enough to build the kernel...

The situation is even more nasty - the one sized fake flex-array
actually is in the middle of the structure.  Besides sizeof-expressions
taking the one member array into account only members before the
variable sized array are used.  I've started a series cleaning up the
few structures that were done that way (for whatever reason), but it's
pretty intrusive.  I don't think papering over these warnings at this
point is a good idea.

<Prev in Thread] Current Thread [Next in Thread>