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]
Message-ID: <alpine.DEB.2.10.1502111033450.2356@hadrien>
Date:	Wed, 11 Feb 2015 10:34:07 +0100 (CET)
From:	Julia Lawall <julia.lawall@...6.fr>
To:	Bas Peters <baspeters93@...il.com>
cc:	clm@...com, jbacik@...com, dsterba@...e.cz,
	linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org,
	kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] fs: btrfs: free-space-cache.c: remove two unnecessary
 checks before calling kfree()



On Wed, 11 Feb 2015, Bas Peters wrote:

> kfree checks whether the pointer it is passed is NULL. The two foregoing
> checks are therefore unnecessary.
>
> This issue was detected using Coccinelle.
>
> Signed-off-by: Bas Peters <baspeters93@...il.com>
> ---
>  fs/btrfs/free-space-cache.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
> index d6c03f7..7d2d817 100644
> --- a/fs/btrfs/free-space-cache.c
> +++ b/fs/btrfs/free-space-cache.c
> @@ -1976,8 +1976,7 @@ new_bitmap:
>
>  out:
>  	if (info) {
> -		if (info->bitmap)
> -			kfree(info->bitmap);
> +		kfree(info->bitmap);
>  		kmem_cache_free(btrfs_free_space_cachep, info);
>  	}
>
> @@ -3427,8 +3426,7 @@ again:
>
>  	if (info)
>  		kmem_cache_free(btrfs_free_space_cachep, info);
> -	if (map)
> -		kfree(map);
> +	kfree(map);

A certain lack of parallelism arises in the latter case.

julia

>  	return 0;
>  }
>
> --
> 2.1.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ