All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: Maarten Lankhorst <m.b.lankhorst@gmail.com>
Cc: xfs-masters@oss.sgi.com, xfs@oss.sgi.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Alex Elder <aelder@sgi.com>
Subject: Re: [PATCH v2] xfs: Silence bounds checking compiler warning
Date: Thu, 23 Jun 2011 10:27:26 -0700	[thread overview]
Message-ID: <m2boxocvb5.fsf@firstfloor.org> (raw)
In-Reply-To: <4E037001.8090306__42924.0493024283$1308849791$gmane$org@gmail.com> (Maarten Lankhorst's message of "Thu, 23 Jun 2011 18:55:29 +0200")

Maarten Lankhorst <m.b.lankhorst@gmail.com> 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@linux.intel.com -- Speaking for myself only

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

WARNING: multiple messages have this Message-ID (diff)
From: Andi Kleen <andi@firstfloor.org>
To: Maarten Lankhorst <m.b.lankhorst@gmail.com>
Cc: Alex Elder <aelder@sgi.com>,
	xfs-masters@oss.sgi.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	xfs@oss.sgi.com
Subject: Re: [PATCH v2] xfs: Silence bounds checking compiler warning
Date: Thu, 23 Jun 2011 10:27:26 -0700	[thread overview]
Message-ID: <m2boxocvb5.fsf@firstfloor.org> (raw)
In-Reply-To: <4E037001.8090306__42924.0493024283$1308849791$gmane$org@gmail.com> (Maarten Lankhorst's message of "Thu, 23 Jun 2011 18:55:29 +0200")

Maarten Lankhorst <m.b.lankhorst@gmail.com> 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@linux.intel.com -- Speaking for myself only

       reply	other threads:[~2011-06-23 17:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4E037001.8090306__42924.0493024283$1308849791$gmane$org@gmail.com>
2011-06-23 17:27 ` Andi Kleen [this message]
2011-06-23 17:27   ` [PATCH v2] xfs: Silence bounds checking compiler warning Andi Kleen
2011-06-23 17:55   ` Al Viro
2011-06-23 17:55     ` Al Viro
2011-06-23 18:13     ` Christoph Hellwig
2011-06-23 18:13       ` Christoph Hellwig
2011-06-24  2:15     ` Dave Chinner
2011-06-24  2:15       ` Dave Chinner
2011-06-23 16:55 Maarten Lankhorst
2011-06-23 16:55 ` Maarten Lankhorst

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2boxocvb5.fsf@firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=aelder@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.b.lankhorst@gmail.com \
    --cc=xfs-masters@oss.sgi.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.