[PATCH v2] xfs: Silence bounds checking compiler warning

Christoph Hellwig hch at infradead.org
Thu Jun 23 13:13:17 CDT 2011


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 6.7.2.1p2, 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.




More information about the xfs mailing list