From: Joe Perches <joe@perches.com>
To: Arnd Bergmann <arnd@arndb.de>,
"Darrick J. Wong" <darrick.wong@oracle.com>,
linux-xfs@vger.kernel.org
Cc: Dave Chinner <dchinner@redhat.com>,
Brian Foster <bfoster@redhat.com>,
Eric Sandeen <sandeen@redhat.com>,
Calvin Owens <calvinowens@fb.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] xfs: avoid harmless gcc-7 warnings
Date: Fri, 12 May 2017 07:18:44 -0700 [thread overview]
Message-ID: <1494598724.2028.19.camel@perches.com> (raw)
In-Reply-To: <20170511124932.226016-1-arnd@arndb.de>
On Thu, 2017-05-11 at 14:49 +0200, Arnd Bergmann wrote:
> gcc-7 flags the use of integer math inside of a condition
> as a potential bug:
>
> fs/xfs/xfs_bmap_util.c: In function 'xfs_swap_extents_check_format':
> fs/xfs/xfs_bmap_util.c:1619:8: error: '<<' in boolean context, did you mean '<' ? [-Werror=int-in-bool-context]
> fs/xfs/xfs_bmap_util.c:1629:8: error: '<<' in boolean context, did you mean '<' ? [-Werror=int-in-bool-context]
>
> This one is clearly fine, and we can add a comparison to zero
> to shut up the warning.
[]
> diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
[]
> @@ -1613,7 +1613,7 @@ xfs_swap_extents_check_format(
> * extent format...
> */
> if (tip->i_d.di_format == XFS_DINODE_FMT_BTREE) {
> - if (XFS_IFORK_BOFF(ip) &&
> + if ((XFS_IFORK_BOFF(ip) != 0) &&
As far as I can tell, this suggestion makes no sense.
$ git grep -E "define\s+XFS_IFORK_BOFF"
fs/xfs/libxfs/xfs_inode_fork.h:#define XFS_IFORK_BOFF(ip) ((int)((ip)->i_d.di_forkoff << 3))
$ git grep -w di_forkoff|grep -P "\w+\s+di_forkoff\s*;"
fs/xfs/libxfs/xfs_format.h: __u8 di_forkoff; /* attr fork offs, <<3 for 64b align */
fs/xfs/libxfs/xfs_inode_buf.h: __uint8_t di_forkoff; /* attr fork offs, <<3 for 64b align */
fs/xfs/libxfs/xfs_log_format.h: __uint8_t di_forkoff; /* attr fork offs, <<3 for 64b align */
prev parent reply other threads:[~2017-05-12 14:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-11 12:49 [PATCH] xfs: avoid harmless gcc-7 warnings Arnd Bergmann
2017-05-11 13:33 ` Eric Sandeen
2017-05-11 14:02 ` Christoph Hellwig
2017-05-11 14:56 ` Arnd Bergmann
2017-05-12 14:18 ` Joe Perches [this message]
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=1494598724.2028.19.camel@perches.com \
--to=joe@perches.com \
--cc=arnd@arndb.de \
--cc=bfoster@redhat.com \
--cc=calvinowens@fb.com \
--cc=darrick.wong@oracle.com \
--cc=dchinner@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).