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: <x4937p86bt8.fsf@segfault.boston.devel.redhat.com>
Date:	Mon, 23 May 2016 11:20:19 -0400
From:	Jeff Moyer <jmoyer@...hat.com>
To:	Mike Danese <mikedanese@...gle.com>
Cc:	kernel-janitors@...r.kernel.org, Jens Axboe <axboe@...nel.dk>,
	linux-block@...r.kernel.org (open list:BLOCK LAYER),
	linux-kernel@...r.kernel.org (open list)
Subject: Re: [PATCH] blk: remove NULL check before freeing functions

Mike Danese <mikedanese@...gle.com> writes:

> Coccinelle complains:
>
> WARNING: NULL check before freeing functions like kfree, debugfs_remove,
> debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider
> reorganizing relevant code to avoid passing NULL values.
>
> Signed-off-by: Mike Danese <mikedanese@...gle.com>

Acked-by: Jeff Moyer <jmoyer@...hat.com>

> ---
>  block/bio-integrity.c | 7 ++-----
>  block/bio.c           | 7 ++-----
>  block/blk-core.c      | 3 +--
>  block/elevator.c      | 3 +--
>  4 files changed, 6 insertions(+), 14 deletions(-)
>
> diff --git a/block/bio-integrity.c b/block/bio-integrity.c
> index 711e4d8d..27bf4e7 100644
> --- a/block/bio-integrity.c
> +++ b/block/bio-integrity.c
> @@ -499,11 +499,8 @@ EXPORT_SYMBOL(bioset_integrity_create);
>  
>  void bioset_integrity_free(struct bio_set *bs)
>  {
> -	if (bs->bio_integrity_pool)
> -		mempool_destroy(bs->bio_integrity_pool);
> -
> -	if (bs->bvec_integrity_pool)
> -		mempool_destroy(bs->bvec_integrity_pool);
> +	mempool_destroy(bs->bio_integrity_pool);
> +	mempool_destroy(bs->bvec_integrity_pool);
>  }
>  EXPORT_SYMBOL(bioset_integrity_free);
>  
> diff --git a/block/bio.c b/block/bio.c
> index 0e4aa42..e1e1773 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -1844,11 +1844,8 @@ void bioset_free(struct bio_set *bs)
>  	if (bs->rescue_workqueue)
>  		destroy_workqueue(bs->rescue_workqueue);
>  
> -	if (bs->bio_pool)
> -		mempool_destroy(bs->bio_pool);
> -
> -	if (bs->bvec_pool)
> -		mempool_destroy(bs->bvec_pool);
> +	mempool_destroy(bs->bio_pool);
> +	mempool_destroy(bs->bvec_pool);
>  
>  	bioset_integrity_free(bs);
>  	bio_put_slab(bs);
> diff --git a/block/blk-core.c b/block/blk-core.c
> index 2475b1c7..916e7c3 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -636,8 +636,7 @@ int blk_init_rl(struct request_list *rl, struct request_queue *q,
>  
>  void blk_exit_rl(struct request_list *rl)
>  {
> -	if (rl->rq_pool)
> -		mempool_destroy(rl->rq_pool);
> +	mempool_destroy(rl->rq_pool);
>  }
>  
>  struct request_queue *blk_alloc_queue(gfp_t gfp_mask)
> diff --git a/block/elevator.c b/block/elevator.c
> index c3555c9..5dc91ca 100644
> --- a/block/elevator.c
> +++ b/block/elevator.c
> @@ -847,8 +847,7 @@ int elv_register(struct elevator_type *e)
>  	spin_lock(&elv_list_lock);
>  	if (elevator_find(e->elevator_name)) {
>  		spin_unlock(&elv_list_lock);
> -		if (e->icq_cache)
> -			kmem_cache_destroy(e->icq_cache);
> +		kmem_cache_destroy(e->icq_cache);
>  		return -EBUSY;
>  	}
>  	list_add_tail(&e->list, &elv_list);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ