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 C5CC8A0547; Wed, 21 Apr 2021 14:03:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8383341A8F; Wed, 21 Apr 2021 14:03:01 +0200 (CEST) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by mails.dpdk.org (Postfix) with ESMTP id EA7BD41A72 for ; Wed, 21 Apr 2021 14:02:59 +0200 (CEST) Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4FQJz50qyVz18JXx for ; Wed, 21 Apr 2021 20:00:33 +0800 (CST) Received: from [10.67.103.128] (10.67.103.128) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.498.0; Wed, 21 Apr 2021 20:02:52 +0800 To: "Ananyev, Konstantin" , "dev@dpdk.org" CC: "Yigit, Ferruh" References: <1619004925-58869-1-git-send-email-humin29@huawei.com> From: "Min Hu (Connor)" Message-ID: <645182d8-0ed4-185f-1f72-c96ae82e34e8@huawei.com> Date: Wed, 21 Apr 2021 20:02:53 +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="gbk"; format=flowed Content-Transfer-Encoding: 8bit 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/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; > >> 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 > > . >