From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by dpdk.org (Postfix) with ESMTP id D826A2D13 for ; Tue, 6 Nov 2018 22:49:07 +0100 (CET) Received: by mail-pf1-f194.google.com with SMTP id g7-v6so4457727pfo.10 for ; Tue, 06 Nov 2018 13:49:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=k6p04W93CGSpfxLr2Gw0HqaUyg6z59j0zKr60x3ljbA=; b=M0dP98vOChtQaFFKR1LyWyXHNArgv6+sZQqzufFV3qEUWRo1IHtpg9QpIOF+gqijtd ryYwdTXn+tseA3mV1XMOFbGL58w77PNVZ2HPSh6iOd6OxaBn2ENszwPVf1UQjNv+DcZC mAjHMc9bfcUMvJSfOpkrr4exjIquNlXy26BlInIlZha1RJJM5OiFXC4tvoggA19mZDpG RfuYxohN1earrGD51B81vc97ZUPBSGC6RMKN1MLh7kz1HtglB7QSVX6BUU1th9AfKXDp O+IewWGMDAbk0WCzz64SDgCOOPyuu6fQkXwvrJADfv6o9a5wwK9MhUhK/U4tS+MHp9g2 X6Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=k6p04W93CGSpfxLr2Gw0HqaUyg6z59j0zKr60x3ljbA=; b=pwNXmYvAWu16EaptJ3XOJmLn9D2uvR32XGv04efxRVEn0AD3itc1N5reBYz60KayO5 1WYuS0y/VUVFyLkfIZtK1Uypbal8RH/H0JwPWZu0SCPa/8pVbGpMmFzoKkbuTpKt22Hb jr4tw9xr7FLW0eAJjjlni0itFdz3l/BAXEGgclFH+7oThT3HoHqvz4B343NPEgXvwFZs hIUhE6caFLfqKi6XF7BDZ21fD7Emf9DfiINqCl9kmXUXD7EbWfPMoxgw7GLo9m5QA4w8 QpGJg15zLcZcAW/yUpAAgqH0k5OZaLhcISap6gd3YeFq7ECtJsq1/zA8RXin13rbBmv6 j0kQ== X-Gm-Message-State: AGRZ1gLvHg5mrxCOHQKRv8JCP001dfkgrGwwYllpYO4I1QnkgHBvt6Yp 3Jcq4R5nlV8ZXToW+Uc4yZqPu3NMWGU= X-Google-Smtp-Source: AJdET5eIJ7Hpzuv1i9sgjrtJrZBVzaER7x/qmHEgGEn4P8kWoyIaZ3ZZXmgKJ3lmYck/5LPWuDw4dw== X-Received: by 2002:a63:8e43:: with SMTP id k64mr25030722pge.346.1541540946510; Tue, 06 Nov 2018 13:49:06 -0800 (PST) Received: from localhost.localdomain ([167.220.103.1]) by smtp.gmail.com with ESMTPSA id y1sm5653608pfi.123.2018.11.06.13.49.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Nov 2018 13:49:05 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Tue, 6 Nov 2018 13:48:59 -0800 Message-Id: <20181106214901.1392-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181106214901.1392-1-stephen@networkplumber.org> References: <20181106214901.1392-1-stephen@networkplumber.org> Subject: [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: Tue, 06 Nov 2018 21:49:08 -0000 Coverity spotted self assignment in BPF eval_divmod. This looks like a bug where the incoming source register should have been used instead. 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