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]
Date:   Wed, 5 Jan 2022 10:04:21 +0800
From:   Joseph Qi <joseph.qi@...ux.alibaba.com>
To:     cgel.zte@...il.com, mark@...heh.com
Cc:     jlbec@...lplan.org, ocfs2-devel@....oracle.com,
        linux-kernel@...r.kernel.org, Minghao Chi <chi.minghao@....com.cn>,
        Zeal Robot <zealci@....com.cn>
Subject: Re: [PATCH] fs/ocfs2: remove redundant ret variable



On 1/4/22 7:23 PM, cgel.zte@...il.com wrote:
> From: Minghao Chi <chi.minghao@....com.cn>
> 
> Return value from dlm_lock() directly instead
> of taking this in another redundant variable.
> 
> Reported-by: Zeal Robot <zealci@....com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@....com.cn>
> Signed-off-by: CGEL ZTE <cgel.zte@...il.com>
> ---
>  fs/ocfs2/stack_user.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
> index 85a47621e0c0..3027a6a05668 100644
> --- a/fs/ocfs2/stack_user.c
> +++ b/fs/ocfs2/stack_user.c
> @@ -683,28 +683,23 @@ static int user_dlm_lock(struct ocfs2_cluster_connection *conn,
>  			 void *name,
>  			 unsigned int namelen)
>  {
> -	int ret;
> -
>  	if (!lksb->lksb_fsdlm.sb_lvbptr)
>  		lksb->lksb_fsdlm.sb_lvbptr = (char *)lksb +
>  					     sizeof(struct dlm_lksb);
>  
> -	ret = dlm_lock(conn->cc_lockspace, mode, &lksb->lksb_fsdlm,
> +	return dlm_lock(conn->cc_lockspace, mode, &lksb->lksb_fsdlm,
>  		       flags|DLM_LKF_NODLCKWT, name, namelen, 0,
>  		       fsdlm_lock_ast_wrapper, lksb,
>  		       fsdlm_blocking_ast_wrapper);

Better to align the parameters as well.

Thanks,
Joseph

> -	return ret;
>  }
>  
>  static int user_dlm_unlock(struct ocfs2_cluster_connection *conn,
>  			   struct ocfs2_dlm_lksb *lksb,
>  			   u32 flags)
>  {
> -	int ret;
>  
> -	ret = dlm_unlock(conn->cc_lockspace, lksb->lksb_fsdlm.sb_lkid,
> +	return dlm_unlock(conn->cc_lockspace, lksb->lksb_fsdlm.sb_lkid,
>  			 flags, &lksb->lksb_fsdlm, lksb);
> -	return ret;
>  }
>  
>  static int user_dlm_lock_status(struct ocfs2_dlm_lksb *lksb)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ