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:   Sun, 10 Apr 2022 20:27:47 -0700
From:   Joe Perches <joe@...ches.com>
To:     cgel.zte@...il.com, dsterba@...e.com
Cc:     clm@...com, josef@...icpanda.com, linux-btrfs@...r.kernel.org,
        linux-kernel@...r.kernel.org, Lv Ruyi <lv.ruyi@....com.cn>,
        Zeal Robot <zealci@....com.cn>
Subject: Re: [PATCH] btrfs: remove unnecessary conditional

On Mon, 2022-04-11 at 03:22 +0000, cgel.zte@...il.com wrote:
> iput() has already handled null and non-null parameter, so it is no
> need to use if().
[]
> diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
[]
> @@ -3846,8 +3846,7 @@ struct inode *create_reloc_inode(struct btrfs_fs_info *fs_info,
>  	btrfs_end_transaction(trans);
>  	btrfs_btree_balance_dirty(fs_info);
>  	if (err) {
> -		if (inode)
> -			iput(inode);
> +		iput(inode);
>  		inode = ERR_PTR(err);
>  	}
>  	return inode;

I think a direct return would be easier to understand.

	if (err) {
		iput(inode);
		return ERR_PTR(err);
	}

	return inode;


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ