From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by dpdk.org (Postfix) with ESMTP id 886CE14EC for ; Wed, 7 Nov 2018 20:51:51 +0100 (CET) Received: by mail-pg1-f195.google.com with SMTP id r9-v6so7756046pgv.6 for ; Wed, 07 Nov 2018 11:51:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lD5Ukbe+X/deYoiOsGxwZxpf41PUyY6dpVNIVMj8IIs=; b=t+ssWOMkiyww/ISV9zvUJikSaq2ENwGnDbFOiGkbDd3wuUfyTxbKIpPbbtJNeRpFJ0 GMcze8NB1ayTqBy5VA+GyGYOUMIgeXLfiJJH2uaUPbT+N5yfuY4KE50BI6aVYfxQ+5Vw FRXJ4tUG7fU3wmigvtZbZRfSw1asI1ExHz0Jar8E1zFDhd3l7WD8yvh7bjUgUX2fnnd8 AWQMD1J2R5VyUyRdvGR7xS/vBFSKhyfF/gBRqn2wK/yGsgiuQ6kAFBT2/1DIBBsK234O 6nxcBfdIOCdgKB5tquMHSAisn6/hYJppnrwSNlOu0jiYOR2Csas7I85z24TLHcwQABto cwvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lD5Ukbe+X/deYoiOsGxwZxpf41PUyY6dpVNIVMj8IIs=; b=LYILHR+O60ZNmgtakIxpVbJThHMRzfs8rbzPhYee0sH705bXaPoL3mu0l4kLt9d4yO +vTBFL16R2VbonBcSsCFppEoCdxkoyc6TaRJVm1IiCZbCK7YGrDC22kAtV44JU0mgGZr 3ESY2DdnZv8ib4kcuq/ETdBYAOVVVQ/FnAeBMthQ0wTgWDnGuXo2PkntCnDXvll8rS85 ObS6OPd3Gp5VsLSc7G4AqZYz74WFUtFJS696mhvHQmvSjGCdkaZZgUWG+Zy0Rm7QiteW MqRhueAv8A+LwVh9EH6eQ53WjgszeX+gEGFEzkjaAeWvS1PaH5/lexPpfP/PDvbj2uuB 2unQ== X-Gm-Message-State: AGRZ1gIFBoDOWi5ifa4hF7rYVtSOfUdQqIEJraG2bm4KHzJA7ukPU4yd Su5/XUx2BnpBp6cqCGaj8mWHwPZtcRE= X-Google-Smtp-Source: AJdET5elviEBum4hDAtXgfyOIcNf5k/cu2nu6+ncjmlUng74OW75dIO1KkjW6wdSuS+DaUpOa47XFA== X-Received: by 2002:a63:314c:: with SMTP id x73mr1345380pgx.323.1541620310459; Wed, 07 Nov 2018 11:51:50 -0800 (PST) Received: from shemminger-XPS-13-9360 ([2001:4898:80e8:2:d680:b177:5a01:34c3]) by smtp.gmail.com with ESMTPSA id d5-v6sm1446030pfo.131.2018.11.07.11.51.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 07 Nov 2018 11:51:50 -0800 (PST) Date: Wed, 7 Nov 2018 11:51:47 -0800 From: Stephen Hemminger To: "Ananyev, Konstantin" Cc: "dev@dpdk.org" Message-ID: <20181107115147.67f026e6@shemminger-XPS-13-9360> In-Reply-To: <2601191342CEEE43887BDE71AB9772580103069BF3@irsmsx105.ger.corp.intel.com> References: <20181106214901.1392-1-stephen@networkplumber.org> <20181106214901.1392-4-stephen@networkplumber.org> <2601191342CEEE43887BDE71AB9772580103069BF3@irsmsx105.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [RFC 3/5] bpf: fix validation of eal_divmod X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Nov 2018 19:51:52 -0000 On Wed, 7 Nov 2018 12:54:54 +0000 "Ananyev, Konstantin" wrote: > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen Hemminger > > Sent: Tuesday, November 6, 2018 9:49 PM > > To: dev@dpdk.org > > Cc: Stephen Hemminger > > Subject: [dpdk-dev] [RFC 3/5] bpf: fix validation of eal_divmod > > > > Coverity spotted self assignment in BPF eval_divmod. > > Yep, there is one. > As I remember I have to add it because one of old versions > of compiler (clang???) complained about 'variable being used uninitialized'. > > > This looks like a bug where the incoming source register > > should have been used instead. > > Nope, that's a wrong guess. > We shouldn't do it here. > Konstantin > > > > > Coverity issue: 302850 > > Fixes: 8021917293d0 ("bpf: add extra validation for input BPF program") > > Signed-off-by: Stephen Hemminger > > --- > > lib/librte_bpf/bpf_validate.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/lib/librte_bpf/bpf_validate.c b/lib/librte_bpf/bpf_validate.c > > index 83983efc4e5c..b768f72c4c02 100644 > > --- a/lib/librte_bpf/bpf_validate.c > > +++ b/lib/librte_bpf/bpf_validate.c > > @@ -512,7 +512,7 @@ eval_divmod(uint32_t op, struct bpf_reg_val *rd, struct bpf_reg_val *rs, > > 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.max = rs->u.max; > > rd->u.min = 0; > > } > > > > -- > > 2.17.1 > Well it was being used unintialized, your trick of self assignment fooled clang but did not fool Coverity. What does the other BPF validator do?