Message ID | 20221026025941.2621795-1-xukuohai@huaweicloud.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp22657wru; Tue, 25 Oct 2022 20:00:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM536zmF6F01sbKZiUMM8bE3IvEApHad3FHCBI8Y26rl2kVuPnXQI86GDLpfkODQfD/AnpV1 X-Received: by 2002:a17:907:2c71:b0:79e:8603:72c6 with SMTP id ib17-20020a1709072c7100b0079e860372c6mr20973866ejc.172.1666753223338; Tue, 25 Oct 2022 20:00:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666753223; cv=none; d=google.com; s=arc-20160816; b=jr404nhnl3K9sWnGH4JNX6ZkYuvIgnaQvyUpmU2KIc9i+JtT3tSkGrVLzZe9sxUgwk FI6oZEowEVrWEjRJwg0Rs/qTiUg6kI4FjSLGHWvoVmsp8DAoSqA4SHeA6fjPw1TtPXBN scVYPmsgxSkTlkmsRCAJZO70f0fus8Ok2d8wJeL7eWgysN2mtFB+GVXRKtO8FgVaSGbt 6qxmGYjGG0SYi9W4TN/eggvCKg9EBaqLXZE4JQqWz5v0Exlz7i11Bp2UADPngEizUHvg +OzdofBmoYt1Xw5B0DnbtTIMarb2+RvGp18aoiTANx2OVViVMDDKqY/r5GopqHdW6ON8 ZGFQ== 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; bh=gfmZj4/sG2u1mhhisOrDXvPLRDkSZbfMDyel8r2c1hM=; b=cZ3TsSVabnFu9xijxtYDIuzjTb513vnLkdHua51DpSbG8susxhYxM0fev1AQtMNo02 gRZtKWIPWO/vkjEev60G3yBQrTNG0CFS5GJVr1NtfxsZlp3SKJV+npRbVvItAgupJOHm BDz2c6xic9xYzPd8h0LX0XyDJ8edOgMaL5dgr3BCZFXyhPA9bmWOlaiYXpsrdsTrSmVX MtWo0KL9T14pJgVF35/M8QWMIL6yI37NVcH3ZwO7o4MTOhZy9hfpfQgQS/pMzy7bbWlR ktW1lgJRymKz7hDusL9HdNAq5cVKgR/Jp7+zyE83F91On3A0LRq1dRIXJ3jcMTns8lp+ j1Sg== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x12-20020aa7d6cc000000b0045cf2d0357asi4068295edr.34.2022.10.25.19.59.53; Tue, 25 Oct 2022 20:00:23 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232445AbiJZCmU (ORCPT <rfc822;pwkd43@gmail.com> + 99 others); Tue, 25 Oct 2022 22:42:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231476AbiJZCmS (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 25 Oct 2022 22:42:18 -0400 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA64760CA7; Tue, 25 Oct 2022 19:42:15 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.169]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4MxtMB4ndFzl7yt; Wed, 26 Oct 2022 10:40:06 +0800 (CST) Received: from k01.huawei.com (unknown [10.67.174.197]) by APP3 (Coremail) with SMTP id _Ch0CgDn+lyDnlhj1o8qAw--.33518S2; Wed, 26 Oct 2022 10:42:12 +0800 (CST) From: Xu Kuohai <xukuohai@huaweicloud.com> To: bpf@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, John Fastabend <john.fastabend@gmail.com>, Andrii Nakryiko <andrii@kernel.org>, Martin KaFai Lau <martin.lau@linux.dev>, Song Liu <song@kernel.org>, Yonghong Song <yhs@fb.com>, KP Singh <kpsingh@kernel.org>, Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>, Jiri Olsa <jolsa@kernel.org>, "David S . Miller" <davem@davemloft.net> Subject: [PATCH bpf-next] bpf: Fix a typo in comment for DFS algorithm Date: Tue, 25 Oct 2022 22:59:41 -0400 Message-Id: <20221026025941.2621795-1-xukuohai@huaweicloud.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: _Ch0CgDn+lyDnlhj1o8qAw--.33518S2 X-Coremail-Antispam: 1UD129KBjvdXoWruFyftr1UJF1DXFyfXFykGrg_yoW3KrgEkr s5Z3ZagrsIq3WfCws3Ca47Xw1jkr15tF18WrnxG39rArWYqw18Wrs5GFn0qa4DZFWUtrZr tF93GrZFqw1Y9jkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUb28YFVCjjxCrM7AC8VAFwI0_Gr0_Xr1l1xkIjI8I6I8E6xAIw20E Y4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM28CjxkF64kEwV A0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0cI8IcVCY1x02 67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I 0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40E x7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x 0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lFIxGxcIEc7CjxVA2Y2ka0xkIwI1l42xK82IY c2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s 026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF 0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0x vE42xK8VAvwI8IcIk0rVWrZr1j6s0DMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2 jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x07UWE__UUUUU= X-CM-SenderInfo: 50xn30hkdlqx5xdzvxpfor3voofrz/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747717428076191059?= X-GMAIL-MSGID: =?utf-8?q?1747717428076191059?= |
Series |
[bpf-next] bpf: Fix a typo in comment for DFS algorithm
|
|
Commit Message
Xu Kuohai
Oct. 26, 2022, 2:59 a.m. UTC
From: Xu Kuohai <xukuohai@huawei.com> There is a typo in comment for DFS algorithm in bpf/verifier.c. The top element should not be popped until all its neighbors have been checked. Fix it. Fixes: 475fb78fbf48 ("bpf: verifier (add branch/goto checks)") Signed-off-by: Xu Kuohai <xukuohai@huawei.com> --- kernel/bpf/verifier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Tue, Oct 25, 2022 at 7:42 PM Xu Kuohai <xukuohai@huaweicloud.com> wrote: > > From: Xu Kuohai <xukuohai@huawei.com> > > There is a typo in comment for DFS algorithm in bpf/verifier.c. The top > element should not be popped until all its neighbors have been checked. > Fix it. > > Fixes: 475fb78fbf48 ("bpf: verifier (add branch/goto checks)") > Signed-off-by: Xu Kuohai <xukuohai@huawei.com> > --- > kernel/bpf/verifier.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c > index b83a8d420520..96ba5ea6d1a6 100644 > --- a/kernel/bpf/verifier.c > +++ b/kernel/bpf/verifier.c > @@ -10662,7 +10662,7 @@ static int check_return_code(struct bpf_verifier_env *env) > * 3 let S be a stack > * 4 S.push(v) > * 5 while S is not empty > - * 6 t <- S.pop() > + * 6 t <- S.top() Even with this fix the comment is not quite accurate. I wonder whether we should keep it or delete it completely. At least please use 'peek' instead of 'top'.
On Tue, Oct 25, 2022 at 11:32:55PM -0700, Alexei Starovoitov wrote: > On Tue, Oct 25, 2022 at 7:42 PM Xu Kuohai <xukuohai@huaweicloud.com> wrote: > > > > From: Xu Kuohai <xukuohai@huawei.com> > > > > There is a typo in comment for DFS algorithm in bpf/verifier.c. The top > > element should not be popped until all its neighbors have been checked. > > Fix it. > > > > Fixes: 475fb78fbf48 ("bpf: verifier (add branch/goto checks)") > > Signed-off-by: Xu Kuohai <xukuohai@huawei.com> > > --- > > kernel/bpf/verifier.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c > > index b83a8d420520..96ba5ea6d1a6 100644 > > --- a/kernel/bpf/verifier.c > > +++ b/kernel/bpf/verifier.c > > @@ -10662,7 +10662,7 @@ static int check_return_code(struct bpf_verifier_env *env) > > * 3 let S be a stack > > * 4 S.push(v) > > * 5 while S is not empty > > - * 6 t <- S.pop() > > + * 6 t <- S.top() > > Even with this fix the comment is not quite accurate. > I wonder whether we should keep it or delete it completely. > At least please use 'peek' instead of 'top'. I think the comment should be in words (like other code comments in the kernel) instead.
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index b83a8d420520..96ba5ea6d1a6 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -10662,7 +10662,7 @@ static int check_return_code(struct bpf_verifier_env *env) * 3 let S be a stack * 4 S.push(v) * 5 while S is not empty - * 6 t <- S.pop() + * 6 t <- S.top() * 7 if t is what we're looking for: * 8 return t * 9 for all edges e in G.adjacentEdges(t) do