| To: | Alex Elder <aelder@xxxxxxx> |
|---|---|
| Subject: | [PATCH v2] xfs: Silence bounds checking compiler warning |
| From: | Maarten Lankhorst <m.b.lankhorst@xxxxxxxxx> |
| Date: | Thu, 23 Jun 2011 18:55:29 +0200 |
| Cc: | xfs-masters@xxxxxxxxxxx, xfs@xxxxxxxxxxx, Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx> |
| Dkim-signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :cc:subject:content-type:content-transfer-encoding; bh=jnWn4hEjc0j9S4zAIYLJu3/9nVXLzJB4+ZG3dCWHcVg=; b=nvT1q0XQvvhpRJfc9c5z9LpfDWR54+OXwJlqgSYB1t3nuFa0DFTcrRPwRDtIxRNmHK QMy6s34YYlYvqYr1n3kVsRkaTsEn2TVbe55FSewu8GM1vXGwIIYHxM9g2v14V/ggrFCS 5unqKFqmfm3+DJiB+SXFfrM+y4SwXUz0DLz7A= |
| Domainkey-signature: | a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; b=tUB2fA0MoSbzJiWyF4iGjBrjyY3+3L9r3YKjgnzfK4FiukmxRP/ARXIqUr3ShSmPgp 4cb0+rJjScZbOIwrMZYvTB8FLLpuR7CgTZ3WfaNX44fBLhpK0S9SHwnm7aSvz5e4FiQb nEaJq0zZsPXTlN3POj4D3o40i6hc8PQ36FSFM= |
| User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc15 Thunderbird/3.1.10 |
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@xxxxxxxxx>
---
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
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [PATCH] xfs: Silence bounds checking compiler warning, Maarten Lankhorst |
|---|---|
| Next by Date: | Re: [PATCH v2] xfs: Silence bounds checking compiler warning, Andi Kleen |
| Previous by Thread: | [PATCH] xfs: Silence bounds checking compiler warning, Maarten Lankhorst |
| Next by Thread: | Re: [PATCH v2] xfs: Silence bounds checking compiler warning, Andi Kleen |
| Indexes: | [Date] [Thread] [Top] [All Lists] |