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: <e7c1b060f1594d21bab96e68c4b53bb3@AcuMS.aculab.com>
Date:   Thu, 29 Apr 2021 08:48:18 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'zhouchuangao' <zhouchuangao@...o.com>,
        David Howells <dhowells@...hat.com>,
        "David S. Miller" <davem@...emloft.net>,
        "Jakub Kicinski" <kuba@...nel.org>,
        "linux-afs@...ts.infradead.org" <linux-afs@...ts.infradead.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] net/rxrpc: Use BUG_ON instead of if condition followed by
 BUG.

From: zhouchuangao
> Sent: 29 April 2021 09:11
> 
> BUG_ON() uses unlikely in if(), which can be optimized at compile time.
> 
>               do { if (unlikely(condition)) BUG(); } while (0)
...
> diff --git a/net/rxrpc/call_object.c b/net/rxrpc/call_object.c
> index 4eb91d95..e5deb6f 100644
> --- a/net/rxrpc/call_object.c
> +++ b/net/rxrpc/call_object.c
> @@ -505,8 +505,7 @@ void rxrpc_release_call(struct rxrpc_sock *rx, struct rxrpc_call *call)
>  	ASSERTCMP(call->state, ==, RXRPC_CALL_COMPLETE);
> 
>  	spin_lock_bh(&call->lock);
> -	if (test_and_set_bit(RXRPC_CALL_RELEASED, &call->flags))
> -		BUG();
> +	BUG_ON(test_and_set_bit(RXRPC_CALL_RELEASED, &call->flags));

Hiding as assignment inside BUG_ON() isn't nice.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ