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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230711063348.GB41919@unreal>
Date: Tue, 11 Jul 2023 09:33:48 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH net-next][resend v1 1/1] netlink: Don't use int as bool
 in netlink_update_socket_mc()

On Mon, Jul 10, 2023 at 01:06:24PM +0300, Andy Shevchenko wrote:
> The bit operations take boolean parameter and return also boolean
> (in test_bit()-like cases). Don't threat booleans as integers when
> it's not needed.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
>  net/netlink/af_netlink.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
> index 383631873748..d81e7a43944c 100644
> --- a/net/netlink/af_netlink.c
> +++ b/net/netlink/af_netlink.c
> @@ -1623,9 +1623,10 @@ EXPORT_SYMBOL(netlink_set_err);
>  /* must be called with netlink table grabbed */
>  static void netlink_update_socket_mc(struct netlink_sock *nlk,
>  				     unsigned int group,
> -				     int is_new)
> +				     bool new)
>  {
> -	int old, new = !!is_new, subscriptions;
> +	int subscriptions;
> +	bool old;
>  
>  	old = test_bit(group - 1, nlk->groups);
>  	subscriptions = nlk->subscriptions - old + new;

So what is the outcome of "int - bool + bool" in the line above?

> @@ -2152,7 +2153,7 @@ void __netlink_clear_multicast_users(struct sock *ksk, unsigned int group)
>  	struct netlink_table *tbl = &nl_table[ksk->sk_protocol];
>  
>  	sk_for_each_bound(sk, &tbl->mc_list)
> -		netlink_update_socket_mc(nlk_sk(sk), group, 0);
> +		netlink_update_socket_mc(nlk_sk(sk), group, false);
>  }
>  
>  struct nlmsghdr *
> -- 
> 2.40.0.1.gaa8946217a0b
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ