xfs
[Top] [All Lists]

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

To: Maarten Lankhorst <m.b.lankhorst@xxxxxxxxx>
Subject: Re: [PATCH v2] xfs: Silence bounds checking compiler warning
From: Andi Kleen <andi@xxxxxxxxxxxxxx>
Date: Thu, 23 Jun 2011 10:27:26 -0700
Cc: Alex Elder <aelder@xxxxxxx>, xfs-masters@xxxxxxxxxxx, Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>, xfs@xxxxxxxxxxx
In-reply-to: <4E037001.8090306__42924.0493024283$1308849791$gmane$org@xxxxxxxxx> (Maarten Lankhorst's message of "Thu, 23 Jun 2011 18:55:29 +0200")
References: <4E037001.8090306__42924.0493024283$1308849791$gmane$org@xxxxxxxxx>
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)
Maarten Lankhorst <m.b.lankhorst@xxxxxxxxx> writes:

> gcc with -Warray-bounds generates a false positive on this
> since xfs defines the struct with u8 name[1]; to be able to
> add a tag at the end.

A better way would be to define it as name[0]. Then the compiler
would know it's a VLA. You may need to check noone relies on
the one byte though.

-Andi
-- 
ak@xxxxxxxxxxxxxxx -- Speaking for myself only

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