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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 15 Oct 2021 12:51:54 +0200
From:   David Sterba <dsterba@...e.cz>
To:     Wan Jiabing <wanjiabing@...o.com>
Cc:     Chris Mason <clm@...com>, Josef Bacik <josef@...icpanda.com>,
        David Sterba <dsterba@...e.com>, linux-btrfs@...r.kernel.org,
        linux-kernel@...r.kernel.org, kael_w@...h.net,
        johannes.thumshirn@....com
Subject: Re: [PATCH] btrfs: Simplify conditional in assert

Adding Johannes to CC,

On Fri, Oct 15, 2021 at 06:36:39AM -0400, Wan Jiabing wrote:
> Fix following coccicheck warning:
> ./fs/btrfs/inode.c:2015:16-18: WARNING !A || A && B is equivalent to !A || B
> 
> Signed-off-by: Wan Jiabing <wanjiabing@...o.com>
> ---
>  fs/btrfs/inode.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index e9154b436c47..da4aeef73b0d 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -2011,8 +2011,7 @@ int btrfs_run_delalloc_range(struct btrfs_inode *inode, struct page *locked_page
>  		 * to use run_delalloc_nocow() here, like for  regular
>  		 * preallocated inodes.
>  		 */
> -		ASSERT(!zoned ||
> -		       (zoned && btrfs_is_data_reloc_root(inode->root)));
> +		ASSERT(!zoned || btrfs_is_data_reloc_root(inode->root));

The short form is equivalent, but I'm not sure it's also on the same
level of readability. Repeating the 'zoned' condition check makes it
obvious on first sight, which is what I'd prefer.

Johannes if you'd like the new version I'll change it but otherwise I'm
fine with what we have now.

>  		ret = run_delalloc_nocow(inode, locked_page, start, end,
>  					 page_started, nr_written);
>  	} else if (!inode_can_compress(inode) ||
> -- 
> 2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ