| To: | Alex Elder <aelder@xxxxxxx> |
|---|---|
| Subject: | Re: [PATCH] xfs: Silence bounds checking compiler warning |
| From: | Maarten Lankhorst <m.b.lankhorst@xxxxxxxxx> |
| Date: | Thu, 23 Jun 2011 17:33:50 +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:references:in-reply-to:content-type :content-transfer-encoding; bh=CVyqsBMeGYVItV11UgBHINw8v1CV0jJmb1jAIjDgANM=; b=H0XFQSzW0JzooNOCIXsdW3BErVIfNI1SqOEu1FIAJUDs2RuXz6q62n3kMFXwuz/7jC gCNDb5yvmbTrQCqayFdVVSxm+bUs9kNoWoBXaoP6e+dNXwc4ddIiO+aGk/x+S8khzHj8 4kUd29Q7/3hoiGtEU4WsPHxaa6oTn1i/KCp9A= |
| Domainkey-signature: | a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=rrc3SjlsRf5nAZIJDIbGEDeBZxdaEOvnKi4SCQHSad47uft2Otv7EivUQ1XyzKtREX Uo54SrboCzkQDM/PSn1BeKq8wRyH+wIx/FgIrFNQM30BzFx+oJyPa8iE/IdHVv5+ISCo SPZTJ9FVeLcKYiBb2I+A3EaG7QBgmCqiOZVk4= |
| In-reply-to: | <4E0356E6.30104@xxxxxxxxx> |
| References: | <4E0356E6.30104@xxxxxxxxx> |
| 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 |
On 06/23/2011 05:08 PM, Maarten Lankhorst wrote: > 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..09b4aed 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] = '.'; > + dep->name[0] = ((__u8 *)dep->name)[1] = '.'; > tagp = xfs_dir2_data_entry_tag_p(dep); > *tagp = cpu_to_be16((char *)dep - (char *)block); > xfs_dir2_data_log_entry(tp, bp, dep); Oops, that still gives a warning, I used (u8*) first which works, but it seems the type conversion was what made it shut up. Is there any type I can cast __u8 to safely, or is memset preferred? gcc was too smart and saw through my __u8 cast. ~Maarten |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH] xfs: Silence bounds checking compiler warning, Maarten Lankhorst |
|---|---|
| Next by Date: | [PATCH v2] xfs: Silence bounds checking compiler warning, Maarten Lankhorst |
| Previous by Thread: | [PATCH] xfs: Silence bounds checking compiler warning, Maarten Lankhorst |
| Next by Thread: | [PATCH v2] xfs: Silence bounds checking compiler warning, Maarten Lankhorst |
| Indexes: | [Date] [Thread] [Top] [All Lists] |