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: <mqdfv2hnzb1.fsf@c203.arch.suse.de>
Date:	Mon, 14 Sep 2015 11:08:18 +0200
From:	Johannes Thumshirn <jthumshirn@...e.de>
To:	Julia Lawall <Julia.Lawall@...6.fr>
Cc:	Kent Overstreet <kent.overstreet@...il.com>,
	sergey.senozhatsky@...il.com, kernel-janitors@...r.kernel.org,
	Neil Brown <neilb@...e.com>, linux-bcache@...r.kernel.org,
	linux-raid@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 15/39] bcache: drop null test before destroy functions

Julia Lawall <Julia.Lawall@...6.fr> writes:

> Remove unneeded NULL test.
>
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @@ expression x; @@
> -if (x != NULL)
>   \(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x);
> // </smpl>
>
> Signed-off-by: Julia Lawall <Julia.Lawall@...6.fr>

Reviewed-by: Johannes Thumshirn <jthumshirn@...e.de>

>
> ---
>  drivers/md/bcache/bset.c    |    3 +--
>  drivers/md/bcache/request.c |    3 +--
>  drivers/md/bcache/super.c   |    9 +++------
>  3 files changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
> index 8e9877b..bd4678c 100644
> --- a/drivers/md/bcache/request.c
> +++ b/drivers/md/bcache/request.c
> @@ -1145,8 +1145,7 @@ void bch_flash_dev_request_init(struct bcache_device *d)
>  
>  void bch_request_exit(void)
>  {
> -	if (bch_search_cache)
> -		kmem_cache_destroy(bch_search_cache);
> +	kmem_cache_destroy(bch_search_cache);
>  }
>  
>  int __init bch_request_init(void)
> diff --git a/drivers/md/bcache/bset.c b/drivers/md/bcache/bset.c
> index 646fe85..479117c 100644
> --- a/drivers/md/bcache/bset.c
> +++ b/drivers/md/bcache/bset.c
> @@ -1116,8 +1116,7 @@ struct bkey *bch_btree_iter_next_filter(struct btree_iter *iter,
>  
>  void bch_bset_sort_state_free(struct bset_sort_state *state)
>  {
> -	if (state->pool)
> -		mempool_destroy(state->pool);
> +	mempool_destroy(state->pool);
>  }
>  
>  int bch_bset_sort_state_init(struct bset_sort_state *state, unsigned page_order)
> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
> index 679a093..c27a0ff 100644
> --- a/drivers/md/bcache/super.c
> +++ b/drivers/md/bcache/super.c
> @@ -1335,12 +1335,9 @@ static void cache_set_free(struct closure *cl)
>  		destroy_workqueue(c->moving_gc_wq);
>  	if (c->bio_split)
>  		bioset_free(c->bio_split);
> -	if (c->fill_iter)
> -		mempool_destroy(c->fill_iter);
> -	if (c->bio_meta)
> -		mempool_destroy(c->bio_meta);
> -	if (c->search)
> -		mempool_destroy(c->search);
> +	mempool_destroy(c->fill_iter);
> +	mempool_destroy(c->bio_meta);
> +	mempool_destroy(c->search);
>  	kfree(c->devices);
>  
>  	mutex_lock(&bch_register_lock);
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bcache" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Johannes Thumshirn                                           Storage
jthumshirn@...e.de                                 +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600  D0D0 0393 969D 2D76 0850
--
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