[net-next,resend,v1,1/1] netlink: Don't use int as bool in netlink_update_socket_mc()
Message ID | 20230710100624.87836-1-andriy.shevchenko@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4933801vqx; Mon, 10 Jul 2023 03:53:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlEbRzLLs6ddg4rJ/qqEYMUw56I2P5gHFaQTTg2ov/ATLneB4B+P52oZNTWzIQCz4HYfy5dp X-Received: by 2002:a05:6512:3703:b0:4f8:7697:5207 with SMTP id z3-20020a056512370300b004f876975207mr7691884lfr.23.1688986392335; Mon, 10 Jul 2023 03:53:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688986392; cv=none; d=google.com; s=arc-20160816; b=hGnvy1Lzh3hkgS3NPk2buGKh6g/p63gpileuP/yKNSpRqBNtTfnfQ0kMIspj2ML9ZC 0e8z38kcRTj7i3PVO+RgnJ2sTUegxpvQ9VABeuMeOBh37XiiUPYEwiYeFeNe92xmpCBH mKPP3GK5NApoGfbWX5f6VSXDuZ2MIx1fCS2d7iUZd4dlrRnUIr2PwWPuNyrQTdKT37Na tJGcXWHdfMR7oNVRTaClP1BPYBFEJ7hpHeraiReMYK7jNQ+NftEJzIFNhu2loxlVge+3 pR7UXZDPvCJVeawr+KD+EN36aCpCuCmA0E1u0DGfehd9VM5M1mTQodY1pHY68SqiOyoB aVag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=e3d8h1ZGT1e8/JR38YFXpby2vZKCdje5K5KPmoiRzg4=; fh=4Kmv4MuK60oO6p3bg/kjyjPwNbnmPFA55Azrr/Nrb38=; b=O0SMqPs0wlt++DwUoiXk/Pjl7F007Jtn98Pw3yFxocoLX4tIHKpm8kab79jLsNPMkf XuLtzDCYeEgP49e0Ws+TSoNykuDb3eRVO5OdjMnxEA7UCcjRejAI/AbLAi1wHrgEF48W JAlwUoT3Csx8cqmnf9CUR1hHetbn2bSHBdj5G+VAabOP29dyTLwLtJ54ygJ+n39KsRVz nsaf2GpYnuxlUmu6zLoL9B9YUHo5DBujjy1oBSyisYKlTio7qBSMNJTPOTcNJ5ZnFMg4 uCGlUGJjDt7dYY3xmlIOG2dGijSq5t094ONsXMu4NdmSE/drq+mLqd/GsGJizSof61q+ 1D/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fO2qwEr5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m18-20020aa7d352000000b0051df5573fcasi8081006edr.429.2023.07.10.03.52.49; Mon, 10 Jul 2023 03:53:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fO2qwEr5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232762AbjGJKJs (ORCPT <rfc822;ybw1215001957@gmail.com> + 99 others); Mon, 10 Jul 2023 06:09:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232158AbjGJKJf (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 10 Jul 2023 06:09:35 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB0A13AA1; Mon, 10 Jul 2023 03:07:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1688983646; x=1720519646; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=fncQgPJyZlG3ZquqvS8Jh6fj4kqURBf5+wPFnw5/rT8=; b=fO2qwEr5xzcSDJHPxsU2H8aTIjoLroXiLVFUcvcEbZBhZSahtC0+RXAC UYUw35i0GJ0j2uQy2Bp2cEq4uJk96i5p/WIC4k7Bj5XewuU01QM3TYhI0 w1fNl+DMoPCEYBh7ezGcWhRxk85rIRk6oKAtrUcyNG6Pw99RjuNLsssCd x/TQjEtke97oTp1nv3RpAummDvGM2D8awm+XtdcY9OP/uIfNlnWRDvUh8 hOy0PkdSQ3l/XV2U9hpWDfXM+rAXoG7AyzuYnQnPk5oR3aGsvd6o5TVMg dTM4aCSiNa71X6IE4lbh1hJLGMLIiCYppMtI1dTWucBrsnZdMEY+5mTZM Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10766"; a="395085738" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="395085738" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jul 2023 03:06:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10766"; a="844825327" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="844825327" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga004.jf.intel.com with ESMTP; 10 Jul 2023 03:06:24 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 203E81FC; Mon, 10 Jul 2023 13:06:28 +0300 (EEST) From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: Jakub Kicinski <kuba@kernel.org>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Paolo Abeni <pabeni@redhat.com>, Andy Shevchenko <andriy.shevchenko@linux.intel.com> Subject: [PATCH net-next][resend v1 1/1] netlink: Don't use int as bool in netlink_update_socket_mc() Date: Mon, 10 Jul 2023 13:06:24 +0300 Message-Id: <20230710100624.87836-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771030595512823697 X-GMAIL-MSGID: 1771030595512823697 |
Series |
[net-next,resend,v1,1/1] netlink: Don't use int as bool in netlink_update_socket_mc()
|
|
Commit Message
Andy Shevchenko
July 10, 2023, 10:06 a.m. UTC
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@linux.intel.com>
---
net/netlink/af_netlink.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
Comments
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@linux.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 > >
On Tue, 2023-07-11 at 09:33 +0300, Leon Romanovsky wrote: > 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@linux.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? FTR, I agree with Leon, the old code is more readable to me/I don't see a practical gain with this change. Cheers, Paolo
On Tue, Jul 11, 2023 at 12:21:12PM +0200, Paolo Abeni wrote: > On Tue, 2023-07-11 at 09:33 +0300, Leon Romanovsky wrote: > > 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@linux.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? The same as with int - int [0 .. 1] + int [0 .. 1]. Note, the code _already_ uses boolean as integers. > FTR, I agree with Leon, the old code is more readable to me/I don't see > a practical gain with this change. This change does not change the status quo. The code uses booleans as integers already (in the callers). As I mentioned earlier, the purity of the code (converting booleans to integers beforehand) adds unneeded churn and with this change code becomes cleaner at least for the (existing) callers.
On Tue, Jul 11, 2023 at 01:54:18PM +0300, Andy Shevchenko wrote: > On Tue, Jul 11, 2023 at 12:21:12PM +0200, Paolo Abeni wrote: > > On Tue, 2023-07-11 at 09:33 +0300, Leon Romanovsky wrote: > > > 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@linux.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? > > The same as with int - int [0 .. 1] + int [0 .. 1]. No, it is not. bool is defined as _Bool C99 type, so strictly speaking you are mixing types int - _Bool + _Bool. Thanks > > Note, the code _already_ uses boolean as integers. > > > FTR, I agree with Leon, the old code is more readable to me/I don't see > > a practical gain with this change. > > This change does not change the status quo. The code uses booleans as integers > already (in the callers). > > As I mentioned earlier, the purity of the code (converting booleans to integers > beforehand) adds unneeded churn and with this change code becomes cleaner at > least for the (existing) callers. > > -- > With Best Regards, > Andy Shevchenko > >
On Tue, Jul 11, 2023 at 03:20:12PM +0300, Leon Romanovsky wrote: > On Tue, Jul 11, 2023 at 01:54:18PM +0300, Andy Shevchenko wrote: > > On Tue, Jul 11, 2023 at 12:21:12PM +0200, Paolo Abeni wrote: > > > On Tue, 2023-07-11 at 09:33 +0300, Leon Romanovsky wrote: > > > > On Mon, Jul 10, 2023 at 01:06:24PM +0300, Andy Shevchenko wrote: ... > > > > So what is the outcome of "int - bool + bool" in the line above? > > > > The same as with int - int [0 .. 1] + int [0 .. 1]. > > No, it is not. bool is defined as _Bool C99 type, so strictly speaking > you are mixing types int - _Bool + _Bool. 1. The original code already does that. You still haven't reacted on that. 2. Is what you are telling a problem?
On Tue, Jul 11, 2023 at 03:45:34PM +0300, Andy Shevchenko wrote: > On Tue, Jul 11, 2023 at 03:20:12PM +0300, Leon Romanovsky wrote: > > On Tue, Jul 11, 2023 at 01:54:18PM +0300, Andy Shevchenko wrote: > > > On Tue, Jul 11, 2023 at 12:21:12PM +0200, Paolo Abeni wrote: > > > > On Tue, 2023-07-11 at 09:33 +0300, Leon Romanovsky wrote: > > > > > On Mon, Jul 10, 2023 at 01:06:24PM +0300, Andy Shevchenko wrote: > > ... > > > > > > So what is the outcome of "int - bool + bool" in the line above? > > > > > > The same as with int - int [0 .. 1] + int [0 .. 1]. > > > > No, it is not. bool is defined as _Bool C99 type, so strictly speaking > > you are mixing types int - _Bool + _Bool. > > 1. The original code already does that. You still haven't reacted on that. The original code was int - int + int. > 2. Is what you are telling a problema? No, I'm saying that you took perfectly correct code which had all types aligned and changed it to have mixed type arithmetic. Thanks > > -- > With Best Regards, > Andy Shevchenko > >
On Tue, Jul 11, 2023 at 04:32:59PM +0300, Leon Romanovsky wrote: > On Tue, Jul 11, 2023 at 03:45:34PM +0300, Andy Shevchenko wrote: > > On Tue, Jul 11, 2023 at 03:20:12PM +0300, Leon Romanovsky wrote: > > > On Tue, Jul 11, 2023 at 01:54:18PM +0300, Andy Shevchenko wrote: > > > > On Tue, Jul 11, 2023 at 12:21:12PM +0200, Paolo Abeni wrote: > > > > > On Tue, 2023-07-11 at 09:33 +0300, Leon Romanovsky wrote: > > > > > > On Mon, Jul 10, 2023 at 01:06:24PM +0300, Andy Shevchenko wrote: ... > > > > > > So what is the outcome of "int - bool + bool" in the line above? > > > > > > > > The same as with int - int [0 .. 1] + int [0 .. 1]. > > > > > > No, it is not. bool is defined as _Bool C99 type, so strictly speaking > > > you are mixing types int - _Bool + _Bool. > > > > 1. The original code already does that. You still haven't reacted on that. > > The original code was int - int + int. No. You missed the callers part. They are using boolean. > > 2. Is what you are telling a problema? > > No, I'm saying that you took perfectly correct code which had all types > aligned and changed it to have mixed type arithmetic. And after this change it's perfectly correct code with less letters and hidden promotions (as a parameter to the function) and hence requires less cognitive energy to parse. So, the bottom line is the commit message you don't like, is it so?
On Tue, Jul 11, 2023 at 04:44:18PM +0300, Andy Shevchenko wrote: > On Tue, Jul 11, 2023 at 04:32:59PM +0300, Leon Romanovsky wrote: > > On Tue, Jul 11, 2023 at 03:45:34PM +0300, Andy Shevchenko wrote: > > > On Tue, Jul 11, 2023 at 03:20:12PM +0300, Leon Romanovsky wrote: > > > > On Tue, Jul 11, 2023 at 01:54:18PM +0300, Andy Shevchenko wrote: > > > > > On Tue, Jul 11, 2023 at 12:21:12PM +0200, Paolo Abeni wrote: > > > > > > On Tue, 2023-07-11 at 09:33 +0300, Leon Romanovsky wrote: > > > > > > > On Mon, Jul 10, 2023 at 01:06:24PM +0300, Andy Shevchenko wrote: > > ... > > > > > > > > So what is the outcome of "int - bool + bool" in the line above? > > > > > > > > > > The same as with int - int [0 .. 1] + int [0 .. 1]. > > > > > > > > No, it is not. bool is defined as _Bool C99 type, so strictly speaking > > > > you are mixing types int - _Bool + _Bool. > > > > > > 1. The original code already does that. You still haven't reacted on that. > > > > The original code was int - int + int. > > No. You missed the callers part. They are using boolean. I didn't miss and pointed you to the exact line which was implicitly changed with your patch. > > > > 2. Is what you are telling a problema? > > > > No, I'm saying that you took perfectly correct code which had all types > > aligned and changed it to have mixed type arithmetic. > > And after this change it's perfectly correct code with less letters and hidden > promotions (as a parameter to the function) and hence requires less cognitive > energy to parse. > > So, the bottom line is the commit message you don't like, is it so? Please reread my and Paolo replies. Thanks > > -- > With Best Regards, > Andy Shevchenko > >
On Tue, Jul 11, 2023 at 08:10:58PM +0300, Leon Romanovsky wrote: > On Tue, Jul 11, 2023 at 04:44:18PM +0300, Andy Shevchenko wrote: > > On Tue, Jul 11, 2023 at 04:32:59PM +0300, Leon Romanovsky wrote: > > > On Tue, Jul 11, 2023 at 03:45:34PM +0300, Andy Shevchenko wrote: > > > > On Tue, Jul 11, 2023 at 03:20:12PM +0300, Leon Romanovsky wrote: > > > > > On Tue, Jul 11, 2023 at 01:54:18PM +0300, Andy Shevchenko wrote: > > > > > > On Tue, Jul 11, 2023 at 12:21:12PM +0200, Paolo Abeni wrote: > > > > > > > On Tue, 2023-07-11 at 09:33 +0300, Leon Romanovsky wrote: > > > > > > > > On Mon, Jul 10, 2023 at 01:06:24PM +0300, Andy Shevchenko wrote: ... > > > > > > > > So what is the outcome of "int - bool + bool" in the line above? > > > > > > > > > > > > The same as with int - int [0 .. 1] + int [0 .. 1]. > > > > > > > > > > No, it is not. bool is defined as _Bool C99 type, so strictly speaking > > > > > you are mixing types int - _Bool + _Bool. > > > > > > > > 1. The original code already does that. You still haven't reacted on that. > > > > > > The original code was int - int + int. > > > > No. You missed the callers part. They are using boolean. > > I didn't miss and pointed you to the exact line which was implicitly > changed with your patch. Yes, and this line doesn't change the status quo. We have boolean in the callers that implicitly went to the callee as int. > > > > 2. Is what you are telling a problema? > > > > > > No, I'm saying that you took perfectly correct code which had all types > > > aligned and changed it to have mixed type arithmetic. > > > > And after this change it's perfectly correct code with less letters and hidden > > promotions (as a parameter to the function) and hence requires less cognitive > > energy to parse. > > > > So, the bottom line is the commit message you don't like, is it so? > > Please reread my and Paolo replies. I have read them. My point is that you should also look at the callers to see the big picture.
On Mon, 10 Jul 2023 13:06:24 +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. I don't have a strong opinion on the merit. But I feel like the discussion is a waste of everyone's time, so to discourage such ambivalent patches I'm going to drop this.
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; @@ -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 *