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]
Date:	Thu, 5 Feb 2015 15:32:33 +0100
From:	Bart Van Assche <bart.vanassche@...disk.com>
To:	SF Markus Elfring <elfring@...rs.sourceforge.net>,
	Hal Rosenstock <hal.rosenstock@...il.com>,
	Roland Dreier <roland@...nel.org>,
	Sean Hefty <sean.hefty@...el.com>, <linux-rdma@...r.kernel.org>
CC:	LKML <linux-kernel@...r.kernel.org>,
	<kernel-janitors@...r.kernel.org>,
	Julia Lawall <julia.lawall@...6.fr>
Subject: Re: [PATCH] InfiniBand: Delete unnecessary checks before the function,
 call "srp_destroy_fr_pool"

On 02/05/15 13:26, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Thu, 5 Feb 2015 13:20:42 +0100
> 
> The srp_destroy_fr_pool() function tests whether its argument is NULL and then
> returns immediately. Thus the test around the call is not needed.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
> ---
>  drivers/infiniband/ulp/srp/ib_srp.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
> index 0747c05..6f5dfa1 100644
> --- a/drivers/infiniband/ulp/srp/ib_srp.c
> +++ b/drivers/infiniband/ulp/srp/ib_srp.c
> @@ -549,8 +549,7 @@ static int srp_create_ch_ib(struct srp_rdma_ch *ch)
>  				     "FR pool allocation failed (%d)\n", ret);
>  			goto err_qp;
>  		}
> -		if (ch->fr_pool)
> -			srp_destroy_fr_pool(ch->fr_pool);
> +		srp_destroy_fr_pool(ch->fr_pool);
>  		ch->fr_pool = fr_pool;
>  	} else if (!dev->use_fast_reg && dev->has_fmr) {
>  		fmr_pool = srp_alloc_fmr_pool(target);
> @@ -615,13 +614,12 @@ static void srp_free_ch_ib(struct srp_target_port *target,
>  	if (!ch->qp)
>  		return;
>  
> -	if (dev->use_fast_reg) {
> -		if (ch->fr_pool)
> -			srp_destroy_fr_pool(ch->fr_pool);
> -	} else {
> +	if (dev->use_fast_reg)
> +		srp_destroy_fr_pool(ch->fr_pool);
> +	else
>  		if (ch->fmr_pool)
>  			ib_destroy_fmr_pool(ch->fmr_pool);
> -	}
> +
>  	srp_destroy_qp(ch);
>  	ib_destroy_cq(ch->send_cq);
>  	ib_destroy_cq(ch->recv_cq);

This patch makes the code in srp_free_ch_ib() asymmetric which is
unfortunate. Please add a test in ib_destroy_fmr_pool() such that the
check before ib_destroy_fmr_pool() can also be eliminated.

Bart.
--
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