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: <d9f643b8a56f870dc757ad9727bf0d543bc2ff99.camel@kernel.org>
Date: Tue, 10 Sep 2024 07:48:47 -0400
From: Jeff Layton <jlayton@...nel.org>
To: Thorsten Blum <thorsten.blum@...lux.com>, trondmy@...nel.org, 
	anna@...nel.org
Cc: linux-nfs@...r.kernel.org, linux-kernel@...r.kernel.org, Benjamin
 Coddington <bcodding@...hat.com>
Subject: Re: [RESEND PATCH] nfs: Remove unnecessary NULL check before kfree()

On Tue, 2024-09-10 at 12:42 +0200, Thorsten Blum wrote:
> Since kfree() already checks if its argument is NULL, an additional
> check before calling kfree() is unnecessary and can be removed.
> 
> Remove it and thus also the following Coccinelle/coccicheck warning
> reported by ifnullfree.cocci:
> 
>   WARNING: NULL check before some freeing functions is not needed
> 
> Reviewed-by: Benjamin Coddington <bcodding@...hat.com>
> Signed-off-by: Thorsten Blum <thorsten.blum@...lux.com>
> ---
>  fs/nfs/read.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/nfs/read.c b/fs/nfs/read.c
> index a6103333b666..81bd1b9aba17 100644
> --- a/fs/nfs/read.c
> +++ b/fs/nfs/read.c
> @@ -48,8 +48,7 @@ static struct nfs_pgio_header *nfs_readhdr_alloc(void)
>  
>  static void nfs_readhdr_free(struct nfs_pgio_header *rhdr)
>  {
> -	if (rhdr->res.scratch != NULL)
> -		kfree(rhdr->res.scratch);
> +	kfree(rhdr->res.scratch);
>  	kmem_cache_free(nfs_rdata_cachep, rhdr);
>  }
>  

Reviewed-by: Jeff Layton <jlayton@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ