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] [day] [month] [year] [list]
Message-ID: <20220111191036.GD656707@magnolia>
Date:   Tue, 11 Jan 2022 11:10:36 -0800
From:   "Darrick J. Wong" <djwong@...nel.org>
To:     cgel.zte@...il.com
Cc:     linux-xfs@...r.kernel.org, linux-kernel@...r.kernel.org,
        Changcheng Deng <deng.changcheng@....com.cn>,
        Zeal Robot <zealci@....com.cn>
Subject: Re: [PATCH] xfs: use swap() to make code cleaner

On Thu, Oct 28, 2021 at 11:28:30AM +0000, cgel.zte@...il.com wrote:
> From: Changcheng Deng <deng.changcheng@....com.cn>
> 
> Use swap() in order to make code cleaner. Issue found by coccinelle.
> 
> Reported-by: Zeal Robot <zealci@....com.cn>
> Signed-off-by: Changcheng Deng <deng.changcheng@....com.cn>

Odd, I pushed this into 5.16 but never publicly RVB'd it.

Sloppy, Darrick, sloopy...

Reviewed-by: Darrick J. Wong <djwong@...nel.org>

--D

> ---
>  fs/xfs/xfs_inode.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
> index a4f6f034fb81..518c82bfc80d 100644
> --- a/fs/xfs/xfs_inode.c
> +++ b/fs/xfs/xfs_inode.c
> @@ -564,8 +564,6 @@ xfs_lock_two_inodes(
>  	struct xfs_inode	*ip1,
>  	uint			ip1_mode)
>  {
> -	struct xfs_inode	*temp;
> -	uint			mode_temp;
>  	int			attempts = 0;
>  	struct xfs_log_item	*lp;
>  
> @@ -578,12 +576,8 @@ xfs_lock_two_inodes(
>  	ASSERT(ip0->i_ino != ip1->i_ino);
>  
>  	if (ip0->i_ino > ip1->i_ino) {
> -		temp = ip0;
> -		ip0 = ip1;
> -		ip1 = temp;
> -		mode_temp = ip0_mode;
> -		ip0_mode = ip1_mode;
> -		ip1_mode = mode_temp;
> +		swap(ip0, ip1);
> +		swap(ip0_mode, ip1_mode);
>  	}
>  
>   again:
> -- 
> 2.25.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ