[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZJ2fG/2AzJ5O0IFr@corigine.com>
Date: Thu, 29 Jun 2023 17:11:23 +0200
From: Simon Horman <simon.horman@...igine.com>
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 v1 1/1] netlink: Don't use int as bool in
netlink_update_socket_mc()
On Thu, Jun 29, 2023 at 04:31:31PM +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 9c9df143a2ec..81e4b802f3f9 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;
Hi Andy,
Doing arithmetic with boolean values doesn't seem right to me.
In any case, net-next is closed.
Please consider reposting once it re-opens, after 10th July.
--
pw-bot: deferred
Powered by blists - more mailing lists