From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932190AbdJWSoP (ORCPT ); Mon, 23 Oct 2017 14:44:15 -0400 Received: from fldsmtpe03.verizon.com ([140.108.26.142]:13819 "EHLO fldsmtpe03.verizon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932143AbdJWSoN (ORCPT ); Mon, 23 Oct 2017 14:44:13 -0400 From: "Levin, Alexander (Sasha Levin)" X-Host: mariner.tdc.vzwcorp.com To: Tim Hansen CC: "davem@davemloft.net" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2] net/sock: Update sk rcu iterator macro. Thread-Topic: [PATCH v2] net/sock: Update sk rcu iterator macro. Thread-Index: AQHTTC66UeAjQzwTA0OgAg9Ls6kNRg== Date: Mon, 23 Oct 2017 18:42:50 +0000 Message-ID: <20171023184247.p54glyvdkgaxht2f@sasha-lappy> References: <20171023153922.orgvwmuvokv6xbi4@debian> In-Reply-To: <20171023153922.orgvwmuvokv6xbi4@debian> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: NeoMutt/20170113 (1.7.2) x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.144.60.250] Content-Type: text/plain; charset="us-ascii" Content-ID: <883DF4C80EEA00428803DCF4B6E2F5B2@vzwcorp.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v9NIiK7d022646 On Mon, Oct 23, 2017 at 11:39:22AM -0400, Tim Hansen wrote: >Mark hlist nodes in sk rcu iterator as protected by the rcu. >hlist_next_rcu accomplishes this and silences the warnings >sparse throws for net/ipv4/udp.c and net/ipv6/udp.c. > >Found with make C=1 net/ipv4/udp.o on linux-next tag >next-20171009. > >Signed-off-by: Tim Hansen >--- > include/net/sock.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > >diff --git a/include/net/sock.h b/include/net/sock.h >index 64e5ac41b9cf..96cb7b7e4924 100644 >--- a/include/net/sock.h >+++ b/include/net/sock.h >@@ -737,10 +737,10 @@ static inline void sk_add_bind_node(struct sock *sk, > * > */ > #define sk_for_each_entry_offset_rcu(tpos, pos, head, offset) \ >- for (pos = rcu_dereference((head)->first); \ >+ for (pos = rcu_dereference(hlist_next_rcu((head)->first)); \ See below. > pos != NULL && \ > ({ tpos = (typeof(*tpos) *)((void *)pos - offset); 1;}); \ >- pos = rcu_dereference(pos->next)) >+ pos = rcu_dereference(hlist_next_rcu(pos->next))) This will return the next-next node instead of just the next one. You probably want just hlist_next_rcu(pos) here. -- Thanks, Sasha