From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 831D9A09E4; Thu, 22 Apr 2021 13:39:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E9FA241D23; Thu, 22 Apr 2021 13:39:08 +0200 (CEST) Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by mails.dpdk.org (Postfix) with ESMTP id 623DC41CAF for ; Thu, 22 Apr 2021 13:39:07 +0200 (CEST) Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4FQwP51YlnzBs9m for ; Thu, 22 Apr 2021 19:36:41 +0800 (CST) Received: from [10.67.103.128] (10.67.103.128) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.498.0; Thu, 22 Apr 2021 19:39:01 +0800 To: "Ananyev, Konstantin" , "dev@dpdk.org" CC: "Yigit, Ferruh" References: <1619004925-58869-1-git-send-email-humin29@huawei.com> <645182d8-0ed4-185f-1f72-c96ae82e34e8@huawei.com> From: "Min Hu (Connor)" Message-ID: <3c12602c-cb0d-1269-dc1e-774844c2e059@huawei.com> Date: Thu, 22 Apr 2021 19:39:01 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="iso-2022-jp"; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.103.128] X-CFilter-Loop: Reflected Subject: Re: [dpdk-dev] [PATCH] bpf: delete meaningless code X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 在 2021/4/22 19:29, Ananyev, Konstantin 写道: > > >> >> 在 2021/4/21 19:43, Ananyev, Konstantin 写道: >>>> >>>> 'rd->u.max = rd->u.max' is meaningless which should be deleted. >>>> >>>> This patch fixed it. >>>> >>>> Fixes: 8021917293d0 ("bpf: add extra validation for input BPF program") >>>> Cc: stable@dpdk.org >>> >>> As I remember, I did it on purpose. >>> Some old (but still supported) version of clang complained >>> about unitialized variable. >> >> Well, how about like this ? >> uint64_t tmp = rd->u.max; >> if (op == BPF_MOD) >> tmp = RTE_MIN(tmp, tmp - 1); >> rd->u.max = tmp; > > > Then, I think it should be: > tmp = RTE_MIN(tmp, rs->u.max - 1); > > Or just leave things as they are right now. > Nothing is broken here. > OK, this patch can be abandoned ,thanks. >>> >>>> Signed-off-by: Min Hu (Connor) >>>> --- >>>> lib/librte_bpf/bpf_validate.c | 2 -- >>>> 1 file changed, 2 deletions(-) >>>> >>>> diff --git a/lib/librte_bpf/bpf_validate.c b/lib/librte_bpf/bpf_validate.c >>>> index 9214f15..c5ad951 100644 >>>> --- a/lib/librte_bpf/bpf_validate.c >>>> +++ b/lib/librte_bpf/bpf_validate.c >>>> @@ -517,8 +517,6 @@ eval_divmod(uint32_t op, struct bpf_reg_val *rd, struct bpf_reg_val *rs, >>>> } else { >>>> if (op == BPF_MOD) >>>> rd->u.max = RTE_MIN(rd->u.max, rs->u.max - 1); >>>> - else >>>> - rd->u.max = rd->u.max; >>>> rd->u.min = 0; >>>> } >>>> >>>> -- >>>> 2.7.4 >>> >>> . >>> > . >