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: <20210607090435.GA10960@gondor.apana.org.au>
Date:   Mon, 7 Jun 2021 17:04:35 +0800
From:   Herbert Xu <herbert@...dor.apana.org.au>
To:     Zheng Yongjun <zhengyongjun3@...wei.com>
Cc:     steffen.klassert@...unet.com, davem@...emloft.net, kuba@...nel.org,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next] xfrm: use BUG_ON instead of if condition
 followed by BUG

On Mon, Jun 07, 2021 at 05:11:21PM +0800, Zheng Yongjun wrote:
> Use BUG_ON instead of if condition followed by BUG.
> 
> This issue was detected with the help of Coccinelle.
> 
> Signed-off-by: Zheng Yongjun <zhengyongjun3@...wei.com>
> ---
>  net/xfrm/xfrm_policy.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
> index ce500f847b99..532314578151 100644
> --- a/net/xfrm/xfrm_policy.c
> +++ b/net/xfrm/xfrm_policy.c
> @@ -421,8 +421,7 @@ void xfrm_policy_destroy(struct xfrm_policy *policy)
>  {
>  	BUG_ON(!policy->walk.dead);
>  
> -	if (del_timer(&policy->timer) || del_timer(&policy->polq.hold_timer))
> -		BUG();
> +	BUG_ON(del_timer(&policy->timer) || del_timer(&policy->polq.hold_timer));

Nack.  Do not put statements with side effects within BUG_ON.
-- 
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ