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

From: Christoph Hellwig
Date: Thu Jun 23 2011 - 14:13:35 EST

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.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at