public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] xfs: Silence bounds checking compiler warning
@ 2011-06-23 16:55 Maarten Lankhorst
  0 siblings, 0 replies; 5+ messages in thread
From: Maarten Lankhorst @ 2011-06-23 16:55 UTC (permalink / raw)
  To: Alex Elder; +Cc: xfs-masters, xfs, Linux Kernel Mailing List

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.

Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
---
 fs/xfs/xfs_dir2_block.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c
index 580d99c..2c5f287 100644
--- a/fs/xfs/xfs_dir2_block.c
+++ b/fs/xfs/xfs_dir2_block.c
@@ -1148,7 +1148,7 @@ xfs_dir2_sf_to_block(
 		((char *)block + XFS_DIR2_DATA_DOTDOT_OFFSET);
 	dep->inumber = cpu_to_be64(xfs_dir2_sf_get_inumber(sfp, &sfp->hdr.parent));
 	dep->namelen = 2;
-	dep->name[0] = dep->name[1] = '.';
+	memset(dep->name, '.', 2);
 	tagp = xfs_dir2_data_entry_tag_p(dep);
 	*tagp = cpu_to_be16((char *)dep - (char *)block);
 	xfs_dir2_data_log_entry(tp, bp, dep);
-- 
1.7.5.4

v2: memset looks like the cleanest solution, other options rely on ugly casts


^ permalink raw reply related	[flat|nested] 5+ messages in thread
[parent not found: <4E037001.8090306__42924.0493024283$1308849791$gmane$org@gmail.com>]

end of thread, other threads:[~2011-06-24  2:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-23 16:55 [PATCH v2] xfs: Silence bounds checking compiler warning Maarten Lankhorst
     [not found] <4E037001.8090306__42924.0493024283$1308849791$gmane$org@gmail.com>
2011-06-23 17:27 ` Andi Kleen
2011-06-23 17:55   ` Al Viro
2011-06-23 18:13     ` Christoph Hellwig
2011-06-24  2:15     ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox