lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Fri, 12 May 2017 07:18:44 -0700
From:   Joe Perches <joe@...ches.com>
To:     Arnd Bergmann <arnd@...db.de>,
        "Darrick J. Wong" <darrick.wong@...cle.com>,
        linux-xfs@...r.kernel.org
Cc:     Dave Chinner <dchinner@...hat.com>,
        Brian Foster <bfoster@...hat.com>,
        Eric Sandeen <sandeen@...hat.com>,
        Calvin Owens <calvinowens@...com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] xfs: avoid harmless gcc-7 warnings

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 */


Powered by blists - more mailing lists