From patchwork Thu Jun 30 07:35:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xing, Beilei" X-Patchwork-Id: 14463 X-Patchwork-Delegate: bruce.richardson@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id A01752C13; Thu, 30 Jun 2016 09:35:51 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id EE5AB2BA2 for ; Thu, 30 Jun 2016 09:35:49 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP; 30 Jun 2016 00:35:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.26,550,1459839600"; d="scan'208"; a="1008030986" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga002.jf.intel.com with ESMTP; 30 Jun 2016 00:35:48 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id u5U7Zkja027777; Thu, 30 Jun 2016 15:35:46 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id u5U7ZgDu014579; Thu, 30 Jun 2016 15:35:44 +0800 Received: (from beileixi@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id u5U7Zgtw014575; Thu, 30 Jun 2016 15:35:42 +0800 From: Beilei Xing To: jingjing.wu@intel.com, michalx.k.jastrzebski@intel.com Cc: dev@dpdk.org, Beilei Xing Date: Thu, 30 Jun 2016 15:35:40 +0800 Message-Id: <1467272140-14544-1-git-send-email-beilei.xing@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH 4/4] examples/tep_term: fix out-of-bounds access X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Coverity reported lots of out-of-bounds in function vxlan_link, these issues should happen when index port_id evaluates to 2, cause size of arrays is 2 in structure. Fix this issue by modifying judgement condition, make sure port_id is less than 2. Fixes: 4abe471ed6fc ("examples/tep_term: implement VXLAN processing") Signed-off-by: Beilei Xing --- examples/tep_termination/vxlan_setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index 37575c2..8f1f15b 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -249,7 +249,7 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) struct rte_eth_tunnel_filter_conf tunnel_filter_conf; - if (unlikely(portid > VXLAN_N_PORTS)) { + if (unlikely(portid >= VXLAN_N_PORTS)) { RTE_LOG(INFO, VHOST_DATA, "(%d) WARNING: Not configuring device," "as already have %d ports for VXLAN.",