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: <20250610145902.GN6156@frogsfrogsfrogs>
Date: Tue, 10 Jun 2025 07:59:02 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: Markus Elfring <Markus.Elfring@....de>
Cc: linux-xfs@...r.kernel.org, Carlos Maiolino <cem@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	kernel-janitors@...r.kernel.org, Christoph Hellwig <hch@....de>,
	Dave Chinner <dchinner@...hat.com>
Subject: Re: [PATCH] xfs: Improve error handling in xfs_mru_cache_create()

On Tue, Jun 10, 2025 at 03:00:27PM +0200, Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Tue, 10 Jun 2025 14:50:07 +0200
> 
> Simplify error handling in this function implementation.
> 
> * Delete unnecessary pointer checks and variable assignments.
> 
> * Omit a redundant function call.
> 
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>

Looks ok,
Reviewed-by: "Darrick J. Wong" <djwong@...nel.org>

--D

> ---
>  fs/xfs/xfs_mru_cache.c | 15 ++++-----------
>  1 file changed, 4 insertions(+), 11 deletions(-)
> 
> diff --git a/fs/xfs/xfs_mru_cache.c b/fs/xfs/xfs_mru_cache.c
> index 08443ceec329..2ed679a52e41 100644
> --- a/fs/xfs/xfs_mru_cache.c
> +++ b/fs/xfs/xfs_mru_cache.c
> @@ -320,7 +320,7 @@ xfs_mru_cache_create(
>  	xfs_mru_cache_free_func_t free_func)
>  {
>  	struct xfs_mru_cache	*mru = NULL;
> -	int			err = 0, grp;
> +	int			grp;
>  	unsigned int		grp_time;
>  
>  	if (mrup)
> @@ -341,8 +341,8 @@ xfs_mru_cache_create(
>  	mru->lists = kzalloc(mru->grp_count * sizeof(*mru->lists),
>  				GFP_KERNEL | __GFP_NOFAIL);
>  	if (!mru->lists) {
> -		err = -ENOMEM;
> -		goto exit;
> +		kfree(mru);
> +		return -ENOMEM;
>  	}
>  
>  	for (grp = 0; grp < mru->grp_count; grp++)
> @@ -361,14 +361,7 @@ xfs_mru_cache_create(
>  	mru->free_func = free_func;
>  	mru->data = data;
>  	*mrup = mru;
> -
> -exit:
> -	if (err && mru && mru->lists)
> -		kfree(mru->lists);
> -	if (err && mru)
> -		kfree(mru);
> -
> -	return err;
> +	return 0;
>  }
>  
>  /*
> -- 
> 2.49.0
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ