Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5910516rwp; Mon, 17 Jul 2023 11:22:21 -0700 (PDT) X-Google-Smtp-Source: APBJJlHMMz6rAXxQ2GzaDDWmbFOB6kVKunPq38grxKAbjFXy5D2OuBa6hRZjfO8cBODFP7SbQruP X-Received: by 2002:a05:6358:7e53:b0:12f:158e:ed88 with SMTP id p19-20020a0563587e5300b0012f158eed88mr9739898rwm.22.1689618141636; Mon, 17 Jul 2023 11:22:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689618141; cv=none; d=google.com; s=arc-20160816; b=qj3IvMbRP5rivfqW8/rR1dUn0zUCuJiLVgycON47XU9fffYuawpWGRAjX7mp4n7aip E9vvbLHVmM1ipqBn1ug/n1fj5YNXgR+QUZQxafgl/WxaLOfL+oWnRnJsGQintabl3mp8 pqHh7TArgoDPAG1ygz/822zEnPKhoQE2eaASwqZovPXe/Ro27f1DxaPFTvLmwNg4QYqi Q/oU+98J4VxddmGHM7w3P810oDIPg9tP3pEmmCv7Vq61NWtj5aGyDrsXa/MAj/C+U4zg U9NmE+BT2ZEt7g067yeqkt9NinxxJ9whbfCoJG9sRxSenIna9YQBUnPGR++ivsFQanQ4 AzZw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YhHscobnfVUlZMOdFBhuYkq4es4JzXWfX8KfEUQqx3Q=; fh=Ye47rP3FOsjQJPqExfLK2r+v4Pyu1H+4etPb0SpsSLg=; b=cCtmVf+SI1yYgjGGEQ2xhq0XooMxemZXZx1a3WZYJT1Yd/T/fKypo0RqvaaghvFD/I Nlkf6UnhgdRxxUEauKr7GG2CCzg9ELJkJVCZ/NJMr8FRTlxQ6iNjS0nGbuH1G4e1Zz8d cO9Yiw6lt+3u96p6HVWTrQVuEkGiWerj8pJvNh9gyapxmkGsKnqRhyHSwgD1zlfmEnjw hqmqtOpt/NBld+gJokIfWWZwBQ4KjfMyWfnVd/SQ0xLqzMUsvoU7Y1VT+xTh5JpK4e0R H7phbWcSJROM0v16zbOApoNqhpezBFeDn+urqtePJz75QRJ5UQYdV6ZZsVu7EjhC6cCu Va6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZzwrAmSW; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s63-20020a637742000000b0054405637a7esi128593pgc.801.2023.07.17.11.22.08; Mon, 17 Jul 2023 11:22:21 -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=@kernel.org header.s=k20201202 header.b=ZzwrAmSW; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231387AbjGQSBY (ORCPT + 99 others); Mon, 17 Jul 2023 14:01:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231135AbjGQSBO (ORCPT ); Mon, 17 Jul 2023 14:01:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EBA1115; Mon, 17 Jul 2023 11:01:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E74FF611CE; Mon, 17 Jul 2023 18:01:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5101BC433CB; Mon, 17 Jul 2023 18:01:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689616872; bh=Y/tGOWx5q4ZXPiE4it7zg9nYO16lZ6O1v/m4xTWMYUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZzwrAmSWJKoFU94kWriauk8IWoBE5TS+HnmT9tykbdY2EHGd4AYQEqu00ysi5aHFl ilwh6BJ0kVhp/tgiuy2qklG84FTHT42EG8indXY6dc4SKsjBRPffbKs+e18ia5PrIc bePSuyefnHyvvqMSMBgyI+vtAnTf4Hfak9p9q+lZYRdv1Dqbaks4EYmmS9t6BHrgvV qfTTWgxs72OwqK6jS+0JYUGn07iRbzAB5m7jaYI+kuQ2rlCASpLmpoDIqfxv0Yq3VD 7UJ+V8ClN6aEQNK70VOvWXDg3rG6EiAAJs70Sczxu4PECyeX7lnsMpUDhnCPWKOmxr B7aU9iDg+nIRQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id D8FA2CE0836; Mon, 17 Jul 2023 11:01:11 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, SeongJae Park , Joel Fernandes , "Paul E . McKenney" Subject: [PATCH rcu 4/7] Docs/RCU/rculist_nulls: Assign 'obj' before use from the examples Date: Mon, 17 Jul 2023 11:01:07 -0700 Message-Id: <20230717180110.1097362-4-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,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: X-Mailing-List: linux-kernel@vger.kernel.org From: SeongJae Park Lookup example code snippets in rculist_nulls.rst are using 'obj' without assignment. Fix the code to assign it properly. Signed-off-by: SeongJae Park Reviewed-by: Joel Fernandes (Google) Signed-off-by: Paul E. McKenney --- Documentation/RCU/rculist_nulls.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/RCU/rculist_nulls.rst b/Documentation/RCU/rculist_nulls.rst index 25b739885cfa..4d6f077552ed 100644 --- a/Documentation/RCU/rculist_nulls.rst +++ b/Documentation/RCU/rculist_nulls.rst @@ -56,7 +56,7 @@ but a version with an additional memory barrier (smp_rmb()) struct hlist_node *node, *next; for (pos = rcu_dereference((head)->first); pos && ({ next = pos->next; smp_rmb(); prefetch(next); 1; }) && - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); + ({ obj = hlist_entry(pos, typeof(*obj), member); 1; }); pos = rcu_dereference(next)) if (obj->key == key) return obj; @@ -68,7 +68,7 @@ And note the traditional hlist_for_each_entry_rcu() misses this smp_rmb():: struct hlist_node *node; for (pos = rcu_dereference((head)->first); pos && ({ prefetch(pos->next); 1; }) && - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); + ({ obj = hlist_entry(pos, typeof(*obj), member); 1; }); pos = rcu_dereference(pos->next)) if (obj->key == key) return obj; -- 2.40.1