From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E7C7C38A2D for ; Wed, 26 Oct 2022 12:05:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233632AbiJZMF2 (ORCPT ); Wed, 26 Oct 2022 08:05:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233629AbiJZMF1 (ORCPT ); Wed, 26 Oct 2022 08:05:27 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D02F532AB4; Wed, 26 Oct 2022 05:05:24 -0700 (PDT) Received: from kwepemi500013.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4My6nM39hRz15M7B; Wed, 26 Oct 2022 20:00:07 +0800 (CST) Received: from [10.67.111.192] (10.67.111.192) by kwepemi500013.china.huawei.com (7.221.188.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 26 Oct 2022 20:04:59 +0800 Message-ID: Date: Wed, 26 Oct 2022 20:04:59 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH bpf-next] bpf: Fix a typo in comment for DFS algorithm Content-Language: en-US To: Alexei Starovoitov , Xu Kuohai CC: bpf , LKML , Alexei Starovoitov , Daniel Borkmann , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , "David S . Miller" References: <20221026025941.2621795-1-xukuohai@huaweicloud.com> From: Xu Kuohai In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.111.192] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemi500013.china.huawei.com (7.221.188.120) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On 10/26/2022 2:32 PM, Alexei Starovoitov wrote: > On Tue, Oct 25, 2022 at 7:42 PM Xu Kuohai wrote: >> >> From: Xu Kuohai >> >> 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 >> --- >> 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. The comment describes the non-recursive DFS algorithm used by the C code. Although it does not describe the full details, it helps us to understand the code, so I think it should be kept. > At least please use 'peek' instead of 'top'. OK.